My ECMAScript 7 wishlist

David Bruant bruant.d at
Fri Jun 6 05:44:21 PDT 2014

Le 06/06/2014 01:08, Rick Waldron a écrit :
> On Thu, Jun 5, 2014 at 6:42 PM, Nicholas C. Zakas 
> <standards at <mailto:standards at>> 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);
I think the intention behind Object.freeze was to make objects immutable 
(at a shallow level), so maybe the semantics of Map.prototype.set (and 
all modifying operations, of Map&co) should be changed to read the 
[[IsExtensible]] and throw if false is returned. Given Maps are already 
in the wild, this decision might need to be taken quickly.

or should an Object.makeImmutable be introduced? (it would be freeze + 
make all internal [[*Data]] objects immutable)

>     * `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`).
(I already know that Nicholas and I disagree on the topic, but sharing 
for debating).

> This can be achieved with Proxy right, or is that too cumbersome?
Code-readability-wise, wrapping in a proxy is as cumbersome as a call to 
Object.preventUndeclaredGet I guess.

This sort of concerns are only development-time concerns and I believe 
the runtime shouldn't be bothered with these (I'm aware it already is in 
various web). For instance, the TypeScript compiler is capable today of 
catching this error. Given that we have free, cross-platform and fairly 
easy to use tools, do we need assistance from the runtime?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list