RE: Re: Mutable Bytes
"Mark Hahn" <[email protected]> Mon, 26 Jul 2004 21:13:24 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <000301c47390$0fbac600$0d01a8c0@MarkVaio> |
Greg Ewing wrote: > It might be useful to keep an immutable Bytes > type around for use as a dictionary key. I've been thinking of adding a Prothon language feature that let's you set the immutable bit on any individual object. The dictionary checks that bit for allowing keys, not the object type. This ability to set the immutability bit is already allowed in C code. This would let you use any Dictionary, List, or Bytes object as a key. I would add a hash function to each type also. We could almost let strings be mutable with this scheme, if dictionary keys are the only reason for immutability. You would never be allowed to turn off the immutable bit. That is an inherently unsafe operation due to the way my locking works.