I don't see how it would be possible in ES6 user code to ever make a
Map/Set or a Map/Set subclass instance immutable, since
`Map.prototype.set.call`/`Set.prototype.add.call` will operate on any
Map/Set-like object's `[[MapData]]`/`[[SetData]]` internal slot. The only
thing I can think of would be using a Proxy to a collection rather than a
collection itself.

I'm probably missing something - can anybody confirm or refute?

On Thu, Apr 30, 2015 at 1:25 PM, Boris Zbarsky <[email protected]> wrote:

> On 4/30/15 3:46 PM, C. Scott Ananian wrote:
>
>> I like the idea of snapshot methods, but they can be implemented in user
>> code using subclasses in ES6.
>>
>
> Can they?  You can't create immutable snapshots in user code afaict...
>
>  But that would still have required an explicit test in
>> Map.clear/set/delete to ensure that they were operating on an instanceof
>> Map and not just on a ReadOnlyMap.
>>
>
> More likely an internal slot check, not an instanceof check.
>
> -Boris
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to