Array comprehensions shorter syntax (?)

Waldemar Horwat waldemar at google.com
Tue May 31 16:06:59 PDT 2011


On 05/29/11 07:00, Dmitry A. Soshnikov wrote:
> Yeah, and ES also supports them. It's called a generator expression; in this proposal it would look like:
>
> let squares = (x * x | x < data, x > 5);

Ahem, that's already a parenthesized comma expression with operands

   x * x | x < data

and

   x > 5.

Remember that | is a perfectly fine binary operator.

     Waldemar

PS.  Block lambdas don't suffer from this problem because neither | nor || is a valid unary prefix operator, so they can be made syntactically unambiguous.


More information about the es-discuss mailing list