My ECMAScript 7 wishlist
waldron.rick at gmail.com
Thu Jun 5 16:08:49 PDT 2014
On Thu, Jun 5, 2014 at 6:42 PM, Nicholas C. Zakas <
standards at nczconsulting.com> wrote:
> I wrote this blog post about some of the pain points I'm dealing with and
> dreams of how ES7 might be able to address them:
> A short overview in lieu of posting the whole article here:
> * `Array.prototype.first()`, `Array.prototype.last()` - return the first
> and last items, respectively.
Check out Till's response to the previous thread about first and last:
> * `Array.prototype.isEmpty()` - return true when empty (would also be nice
> on strings, maps, etc.).
> * `Function.empty` - a standard empty function that can be used when you
> just want an empty function (IMHO, it indicates intent much better than
> other options toda).
> * Custom descriptor attributes - David mentioned this likely will never
> happen, which makes me sad. Maybe the decorators proposal solves this use
The Proxy security issue:
I had hoped that a "black list" of writable, configurable, enumerable
properties would suffice:
but I there is a discussion around some form of custom meta properties.
> * `Object.deepPreventExtensions()`, `Object.deepSeal()`,
> `Object.deepFreeze()` - deep versions of `Object.preventExtensions()`, et
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());
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.
> * `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?
> * Lightweight traits - simple syntax sugar for object literals and classes
> to facilitate mixins.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss