On Fri, Sep 23, 2011 at 1:08 PM, Denis Kudriashov <[email protected]>wrote:

> Hello,
>
> I use hash message to generate unique object id. (unique between current
> memory objects).
> And I catch situation when two objects has same hash value. Objects has
> been created in loop almost at same time.
>
> So my question - is it really possible?
> Can it be bug in my current VM which I used? (it is cog but very old)
>
> What you can recomment me for unique object id?
>

What marcus said is correct.
THe only easy way is to have an instVar in your objects. You can put
instances of UUID.

    UUID new -> 545bd8d5-18d5-41c0-b11a-63d82dcef783

Otherwise, if you are lucky and you have domain objects (like Person >> id)
that can use they own implementation of #hash, do it !!


> Best regards,
> Denis
>



-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to