Array Comprehensions

David Bruant bruant.d at gmail.com
Tue Feb 7 13:28:17 UTC 2017


Le 06/02/2017 à 17:59, Ryan Birmingham a écrit :
> Hello all,
>
> I frequently find myself desiring a short array or generator 
> comprehension syntax. I'm aware that there are functional ways around 
> use of comprehension syntax, but I personally (at least) love the 
> syntax in the ES reference 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions).
>
> The best previous discussion on this that I found was six years old 
> (https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and 
> answers some of my questions, raising others. That said, I wanted to ask:
>
>   * Why is the Comprehension Syntax in the reference yet not more
>     standard? It feels almost like a tease.
>
Proposals to change the standard are listed here :
https://github.com/tc39/proposals
The process for a feature to become standard is described here :
https://tc39.github.io/process-document/

>   * How do you usually approach or avoid this issue?
>   * Do you think we should look at improving and standardizing the
>     comprehension syntax?
>
Some might argue it is yet another instance of "superficial sugar 
obsession" [1] :-p I don't know where I stand personally.

In any case, if you want to start, write down a proposal (can be 20 
lines in a gist [2]) including programs that are hard to express in 
JavaScript and which readability would significantly be improved with 
the new syntax.
Perhaps submit it to the mailing-list and try to find a "TC39 champion" 
(criterion to enter stage 1).
At the very least, the proposal will be listed in the stage 0 proposals 
list [3].

David

[1] https://twitter.com/mikeal/status/828674319651786754
[2] http://gist.github.com/
[3] https://github.com/tc39/proposals/blob/master/stage-0-proposals.md
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170207/d5aff14c/attachment.html>


More information about the es-discuss mailing list