demerphq wrote: >These are /restricted hashes/. You are imputing that restricted hashes >are immutable in a way that hasn't been agreed on. With respect to restricted hashes, I'm only expecting them to maintain the level of immutability that they display in normal hash operations. Some aspects of them are immutable, others are not, and it seems to be pretty well established which parts are which, excluding localisation and refaliasing. But I think restricted hashes are a distraction here. The same principles also apply to read-only arrays, which have much more straightforward semantics. Most of the same reasoning about language semantics is applicable there. Ultimately I'm more interested in the semantics of read-only arrays, and of the not-restricted-hash read-only hashes that I'd like to add. I've been debating on the basis that the immutable aspects of read-only arrays should behave the same as the immutable aspects of restricted hashes, assuming that consistency between them is desirable. But restricted hashes could end up getting even weirder semantics that would break that analogy. >I am curious what you mean by that. My idea of straightforward read-only hashes is that the read-only-ness of the hash governs the mapping of keys to element scalars. That is, in a read-only hash one would be unable to insert any new key, delete any existing key, or change to which scalar any existing key refers. This differs from a restricted hash in that existing elements can't be deleted even if the element scalar is writable, and there's no concept of a deleted key that it is permitted to re-add. (Also lookups of non-existent keys wouldn't die, but that's a superficial issue.) I find this kind of read-only-ness to be natural: within a data structure it means that we have a read-only flag controlling everything mutable in the range from the hash identity up to the point where other read-only flags (on the element scalars) take over. It's also the direct parallel of the read-only-ness of arrays, which is similarly natural. -zeframThread Previous | Thread Next