[Vm-dev] Re: [Pharo-project] Do we have the new primitive?? [WAS] Re: IdentitySet but using #hash rather than #identityHash ?

Levente Uzonyi leves at elte.hu
Sat May 5 20:46:11 UTC 2012

(neither alpine, nor imp/horde can quote your mail due to the empty 
first attachment added by gmail, sorry)

Thanks Eliot for looking into this issue.

Yes, endIndex is very useful. For example LargeIdentityDictionary uses 
dynamic arrays to store the keys and values. The first element is stored 
at the first slot and we know the index of the last slot where an element 
is stored. The slots after that index conatain nil. The endIndex parameter 
makes it possible to avoid searching those nils if the element is not in 
the dictionary and simplifies the code, because searching for nil doesn't 
need special handling.

I'm not sure if it's okay to use #longAt: in the loop, because the 
receiver can be an object which stores bytes (e.g.: ByteString/ByteArray) 
and I'd expect that the primivite also works correctly in that case. This 
would also make it possible to replace the existing linear search 
primitive for strings with this primitive.


More information about the Vm-dev mailing list