Semantics and abstract syntax of lambdas

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Fri Dec 5 18:20:46 PST 2008


Michael Day wrote:
> Hi Brendan,
> 
>> Please read
>>
>> http://wiki.ecmascript.org/doku.php?id=strawman:lambdas
> 
> There is a lot of discussion over whether it is necessary to introduce
> syntax sugar instead of a "lambda" keyword, but is there any remaining
> controversy over the semantics of lambdas in JavaScript, or is that
> considered settled at this point?

Semantic or abstract-syntax issues that are not settled include:

 - how to avoid the hazard pointed out by Mark Miller where a value
   can be unintentionally leaked from the tail position of a lambda;

 - whether the primitive form of a lambda has a block, statement, or
   expression as its body;

 - some details of the desugaring of functions to lambdas, for example
   how to handle hoisting of 'var' declarations;

 - the interaction of 'let'/'const' declarations with lambdas, especially
   if the former do not have consistent semantics for all scopes;

 - whether lambdas are mutable, immutable, or can be either;

 - how 'break', 'continue', and 'return' are bound (which interacts
   with other proposals such as
   <http://wiki.ecmascript.org/doku.php?id=strawman:return_to_label>,
   and how/whether user-defined control structures are to be supported);

 - the precise semantics of calling a lambda that contains a 'break'
   or 'continue' to a loop or statement that has already completed, or
   a 'return' from a function execution that has already completed;

 - how much of the feature set proposed on the strawman page (for
   example default and destructured arguments) is supported by the
   primitive form of a lambda, vs by desugaring.

The strawman page has suggested answers for some of these issues, but
not all of them, and the answers given on that page are not fixed in
stone.

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list