My ECMAScript 7 wishlist
Nicholas C. Zakas
standards at nczconsulting.com
Fri Jun 6 09:08:03 PDT 2014
On 6/5/2014 4:08 PM, Rick Waldron wrote:
>
> * `Object.deepPreventExtensions()`, `Object.deepSeal()`,
> `Object.deepFreeze()` - deep versions of
> `Object.preventExtensions()`, et al.
>
>
> Does "deep" mean that a Map instance's [[MapData]] is frozen if
> deepFreeze is called on a ? eg. what happens here:
>
> var m = Object.deepFreeze(new Map());
> m.set(1, 1);
>
> In your blog it mentions the silent failure in non-strict mode, I
> suspect that would still have to apply to these additions for semantic
> consistency.
I wouldn't expect this to apply to [[MapData]] since those are not
enumerable own properties of the map instance.
>
> * `Object.preventUndeclaredGet()` - change an object's behavior to
> throw an error if you try to read from a property that doesn't
> exist (instead of returning `undefine`).
>
>
> This can be achieved with Proxy right, or is that too cumbersome?
It can be done with Proxy, but that kind of sucks because I always need
to go through the extra step of creating the Proxy for each object and
passing around the Proxy instead. To me, this is similar to setting a
property to be readonly in strict mode, except its writeonly (or rather,
write-first).
--
___________________________
Nicholas C. Zakas
http://www.nczonline.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140606/2a00f0bf/attachment.html>
More information about the es-discuss
mailing list