RE: Re: Mutable Bytes
Greg Ewing <[email protected]> Fri, 30 Jul 2004 14:28:48 +1200
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
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. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [email protected] +--------------------------------------+