At 05:47 AM 7/2/2005, Ian Griffiths wrote
>> special code needs to exist to ensure that once GetHashCode()
>> has returned a value, that object instance must always return
>> the same value from later GetHashCode calls.
>
>Nope.  I know the docs say that GetHashCode must always return the same
>value, but they are wrong.

I am very glad to hear that.  The behavior that I suggested implementing seemed 
pretty stupid; it was akin to having the GHC() result be morally equivalent to 
an "object id" and that doesn't make sense based on what the name is.

Giving objects an immutable ID has some advantages (particularly in some 
persistence schemes), but the need for it is greatly reduced when the GC lets 
us use the object reference as an "immutable" ID, as each copy of the reference 
value (the memory address) gets updated if the object moves.

>See the "Documentation Rant" section in the second half of this:
>http://www.interact-sw.co.uk/iangblog/2004/06/21/gethashcode

Thanks for that pointer.  [snip]

J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to