Mark S. Miller (2015-04-30T19:48:35.000Z)
On Thu, Apr 30, 2015 at 12:46 PM, C. Scott Ananian <ecmascript at cscott.net>
wrote:

> I like the idea of snapshot methods, but they can be implemented in user
> code using subclasses in ES6.  I'm particularly interested in the "lock
> down in place" mechanism because it *cannot* be implemented in user code.
>
> And yes, if we had it all to do over again, it would have been nice if the
> Map prototype chain was:
>
> Map instance -> Map.prototype -> ReadOnlyMap.prototype -> null
>
> And clear/set/delete were properties of Map.prototype.
>
> 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.
>

Yes, it does not save a test. Rather it only rationalizes the types of
objects so that the type of an immutable or readOnly collection does not
include useless mutation methods; that's all.




>   --scott
> ​
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150430/126aedab/attachment-0001.html>
d at domenic.me (2015-05-11T16:56:59.526Z)
On Thu, Apr 30, 2015 at 12:46 PM, C. Scott Ananian <ecmascript at cscott.net> wrote:

> 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.

Yes, it does not save a test. Rather it only rationalizes the types of
objects so that the type of an immutable or readOnly collection does not
include useless mutation methods; that's all.