*.empty Idea

Jordan Harband ljharb at gmail.com
Thu Apr 30 21:57:30 UTC 2015


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 <bzbarsky at mit.edu> 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
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150430/4b9aac20/attachment.html>


More information about the es-discuss mailing list