RE: Re: Mutable Bytes
"Mark Hahn" <[email protected]> Thu, 29 Jul 2004 20:28:06 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <000401c475e5$3ab41ee0$0d01a8c0@MarkVaio> |
Greg Ewing wrote: > Mark Hahn <[email protected]>: > > > The reason I changed it to check the immutable bit is that the > > built-in types aren't really immutable until they are > initialized. An > > Int object will effectively change value when it goes from > having no > > value to having a value. > > It would be better to check the immutable bit in the hash > functions of the objects concerned. It's only for those > particular object types that the immutable bit implies > usability as a key and vice versa. > > In the general case, the immutable bit being set is neither > necessary nor sufficient for an object to be usable as a key. > The comparison function might depend on state which doesn't > change, even though other parts of the object's state can > change. Conversely, it might depend on the state of other > objects referenced by the object which can change, even > though the object itself is marked as immutable. > > So tying this to the immutable bit in general for all objects > is wrong, IMO. I understand. The list, for example, can be checked for equality and yet it is dependent on other objects. Do you think I should just pull the immutability check?