For http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival I have
written up the Ruby-inspired {|x| x * x} syntax.
Alternatives (ignoring keyword issues) that look more like function syntax
(Peter's suggestion of lambda (x) { x * x }, e.g.) seem worse in this light:
block lambdas do follow the correspondence principle, which is novel to JS with
its C statements for control effects heritage.
In this light, the use of | | to bracket formal parameters seems better than
anything using (...) {...}. This is not an overriding concern, but it seems
worth mentioning. We want block-lambdas or any such TCP-pure new thing to have
syntax that says "look! something new here".
And, since the strawman builds on block syntax, we want the new form to have
syntax that "looks like a block", in which you'd expect TCP purity for break,
continue, return, |this|, and arguments.
Thus, block lambdas that start with { and have lightweight parameter delimiters.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss