[Vm-dev] String hash function

Andres Valloud avalloud at smalltalk.comcastbiz.net
Fri Apr 14 23:38:04 UTC 2017


If it were up to me, I'd leave that decision to the applications.  No 
need to optimize unknown future problems.  Also keep in mind 
applications likely should refine strings by composition and delegation 
rather than by inheritance in this particular case.  Otherwise,

String
	Base64EncodedMP3File
	PostgresqlDataBlob
	SmalltalkMethodSourceCode

... and it stops making sense quickly.

On 4/14/17 16:12 , Ben Coman wrote:
> What are opinions on having a HashedString subclassed from String to
> optimise calculating hash only once?
>
>   a. In the standard Image or leave it specific to applications?
>
>   b. Obviously an ivar to store the hash computed at instantiation.
>
>   c. Maybe have an ivar storing a custom hash-block? Equality would
> check this is identical between objects.


More information about the Vm-dev mailing list