Function Syntax
Jorge
jorge at jorgechamorro.com
Wed May 11 11:26:24 PDT 2011
On 11/05/2011, at 18:53, Brendan Eich wrote:
> (...)
>
> 3c. The use of {| (possibly with space in between) is an unambiguous extension, but formal parameters inside |...| delimiters creates a problem for http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values. We would need the default value expression to be parenthesized if its precedence were | (bitwise-or) or looser.
I don't think it's a problem, after all that's what parenthesis are for.
> Other than these, AFAICT blocks as lambdas offering shorter function-like syntax are pretty good.
Yes, [ ... ].forEach( {| v, i, o | ... } ) would be awesome, and {| n | while (n--) buffer[n]= 0 }( buffer.length ) is even beautiful.
> Should we reconsider them?
Yes. Ruby's blocks, pure win. :-)
--
Jorge.
More information about the es-discuss
mailing list