I like this, too (to use this as a TCP expression).

It is even sorta logically readable. If you encounter do expression without (args), it is naturally TCP. If you precede it with (args), it is easy to read it as "do expression with args, to be evaluated on-demand", so TCP as well.

Though I understand you are trying to find shorter function syntax, not a lambda replacement... but: - is it needed (it would be nice, and could be in par with method definition in object literal) when (args) do {...} fills the spot in majority of short ad-hoc callback scenario? - couldn't Isaac's (args) {...} exists alongside of it? do expression is, by definition, a TCP things, since there is do; do-less variant declares/expresses old-style function? They may look similar, but they are really different.

Herby

David Herman wrote:
On Mar 6, 2012, at 2:56 PM, Brendan Eich wrote:

David Herman wrote:

Moreover, if you wanted to do some control along with an expression,
you could use do-expressions:

myList.map((x) do { for (...) { ... } f(x) })

Note that combination (expression closures + do-expressions) brings
back the exact same expressiveness of block-lambda.

Not so, because no TCP. Only block-lambdas preserve TCP fully.

Says you! :)

To be clear: what I'm suggesting is that expression closures would *not*
be syntactic sugar for statement bodies, but rather would be
TCP-respecting. Most of the time this wouldn't even be noticeable, until
you use do-expressions.

Dave


------------------------------------------------------------------------

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to