My ECMAScript 7 wishlist
Rick Waldron
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:
>
> http://www.nczonline.net/blog/2014/06/03/my-ecmascript-7-wishlist/
>
> 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:
https://mail.mozilla.org/pipermail/es-discuss/2014-May/037158.html
> * `Array.prototype.isEmpty()` - return true when empty (would also be nice
> on strings, maps, etc.).
>
+1
> * `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).
>
+1
> * Custom descriptor attributes - David mentioned this likely will never
> happen, which makes me sad. Maybe the decorators proposal solves this use
> case.
>
The Proxy security issue:
http://esdiscuss.org/topic/object-getownpropertydescriptor-can-return-just-about-anything
I had hoped that a "black list" of writable, configurable, enumerable
properties would suffice:
http://esdiscuss.org/topic/object-getownpropertydescriptor-can-return-just-about-anything#content-14
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
> 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.
> * `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.
>
+ 1
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140605/fd63ff6a/attachment-0001.html>
More information about the es-discuss
mailing list