On Oct 15, 2008, at 2:36 PM, Waldemar Horwat wrote:

There is no such thing as a "let expression".

Let expressions in JS1.7 (Firefox 2+), based on the ES4 proposal. ES3- ish grammar:

LetExpression :
let ( VariableDeclarationList ) [lookahead ∉ {{}] AssignmentExpression

produced from PrimaryExpression.


It's mandatory because the grammar and semicolon insertion rules say so. Btw, to properly terminate a lambda expression you'd need *two* semicolons. Here's why one would be insufficient:

f = lambda(x) x;
(a + b) && c;

would parse the body of the lambda as the expression "x;", the "(a + b)" as an argument to the lambda, and the rest as applying to the result of calling the lambda. What you'd want to write instead would be:

f = lambda(x) x;;

Expression closures in JS1.8 (Firefox 3+) do not have this problem. Using ES3's notation:

FunctionDeclaration :
      function Identifier ( FormalParameterListopt ) FunctionBody
FunctionExpression :
      function Identifieropt ( FormalParameterListopt ) FunctionBody
FormalParameterList :
      Identifier
      FormalParameterList , Identifier
FunctionBody :
      { SourceElements }
      [lookahead ∉ {{}] AssignmentExpression

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

Reply via email to