Allen's lambda syntax proposal

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Sat Dec 6 19:51:13 PST 2008


Eric Suen wrote:
> But in page:
> 
> http://wiki.ecmascript.org/doku.php?id=strawman:lambdas
> 
> lambda is not just a expression, it could be a Declaration.
> 
> If lambda is only a expression, that is why I suggest in post:
> 
> https://mail.mozilla.org/pipermail/es-discuss/2008-December/008382.html

# No, "\" worse than '^' or '&', why not use
#
# function ^ Identifier ( parameters ) block for declaration
#
# and use
#
# ^ IdentifierOpt ( parameters ) block for expression
#
# ExpressionStatement ::= [lookahead !{ {, function, ^ }] CommaExpression


The keyword 'function' shouldn't be used for this because a lambda is
not a function. However,

  const name(formals) ...
  let name(formals) ...

could be sugar for

  const name = lambda(formals) ...;
  let name = lambda(formals) ...;

(replacing 'lambda' with whatever symbol or keyword is chosen). Then there
is no need to change the negative lookahead in ExpressionStatement.

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list