Different semantics should have different-looking syntax
Brendan Eich
brendan at mozilla.com
Sat May 21 13:20:30 PDT 2011
On May 21, 2011, at 12:37 PM, Brendan Eich wrote:
> 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,
Urgh, I meant to write "supports building control abstractions that mimic keyword-head governing block syntax", or something like that. Came off as circular arguing the way I wrote it.
> 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.
Point is we want light weight, control abstractions, TCP, lambdas. In the proposal this leads to (a) block lambdas; (b) paren-free calls provided actuals are block lambdas.
/be
>
> Thus, block lambdas that start with { and have lightweight parameter delimiters.
>
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
More information about the es-discuss
mailing list