Mark S. Miller (2015-04-30T19:15:13.000Z)
d at domenic.me (2015-05-11T16:56:34.359Z)
That is indeed the kind of proposal I was looking for, thanks. An issue is that it locks down the Map in place, which is a design issue we can debate but is not necessarily a show stopper. I would be happy to see this enter stage zero to get the conversation started, Another possibility is to have collections respond to messages like - .snapshot() -- returns an immutable snapshot of the receiver collection - .diverge() -- returns a mutable collection whose initial state is the a snapshot of the receiver - .readOnly() -- returns a readOnly view of a possibly mutable collection. by returning a new derived collection with the desired mutability. Given that c is a conforming collection, we'd have the following algebraic properties ```js c.snapshot().snapshot() === c.snapshot() c.snapshot().readOnly() === c.snapshot() c.readOnly().readOnly() === c.readOnly() c.diverge() !== c ``` Further, for each mutable collection type, it would be nice (by possibly too breaking of a change) to insert a superclass above it whose prototype holds its query method including the three above, leaving only the mutation methods on the existing subtype. Then, .snapshot() and .readOnly() could return an instance of this supertype that is not an instance of the mutable subtype.