return when desugaring to closures
Brendan Eich
brendan at mozilla.com
Fri Oct 17 16:49:03 PDT 2008
On Oct 16, 2008, at 3:40 PM, Brendan Eich wrote:
> For now I favor the lambda expression form as well as the lambda
> block form.
Good thing I added "For now". Since I'm convinced by Waldemar's
argument against ambiguity, I have to drop support for the lambda
expression form. It could be rescued, maybe -- but at what cost? I'd
rather get on with harmonious lambda and let work.
In that light, having let {...} be sugar for lambda () { ... } () is
good.
Making lambda's parenthesized formal parameter list optional still
rubs me the wrong way. It's unambiguous given the block's braces. The
symmetry break with function means lambda{x}() returns x where
function(){return x}() (in an expression context) has matching () for
formals and actuals. But others reasonably object to the extra
insignificant parens. So I'll go with the flow and endorse lambda
{...} for nullary lambda -- for now. :-)
/be
More information about the Es-discuss
mailing list