Allen's lambda syntax proposal

Brendan Eich brendan at mozilla.com
Thu Dec 4 18:08:00 PST 2008


On Dec 4, 2008, at 5:44 PM, Eugene Lazutkin wrote:

> If you started to recap the history of this discussion, could you (or
> anybody else in the know) verbalize following things:
>
> 1) What is the difference between the function and the lambda? I am  
> not
> talking about their syntax, I want to understand the semantic
> difference, if there is any.

Please read

http://wiki.ecmascript.org/doku.php?id=strawman:lambdas


> 2) Why is it important for a lambda to have an optional name?

It may not be.


> What's
> wrong with using a function, if we want a name? IMHO lambda should  
> have
> the minimalistic syntax.

"Minimalistic" does not define itself. The question is what is the  
minimal syntax given various constraints.

Church's Lambdas take one argument only. One can curry by hand. Why  
isn't that the minimum minimum?


> 3) Why is it important to be able to specify parameter defaults in
> lambda? Again, it looks like an extra sugar to me that can be  
> covered by
> a function with parameter defaults.

See

https://mail.mozilla.org/pipermail/es-discuss/2008-October/007715.html

Also consider that default parameters are a convenience we want  
lambdas to have if we believe functions should be avoided for much  
lambda-coding by hand. The countervailing argument is that lambdas  
have unintended completion value hazards, but Schemers and others  
don't worry about these and would prefer not to have to run back to  
functions and lose Tennent's Correspondence Principle every time  
default parameters beckon.


> The reason I ask is a lot of discussion is going around "but if it  
> has a
> name" and "but if it has a default". If it doesn't have a name I would
> be satisfied personally with \(a, b) {...} --- it doesn't clash with
> anything. Or even with \(a, b) expr.


You're right to question name to rescue \, but trying to minimize  
lambdas won't save all the proposed syntaxes. We're making progress in  
finding some to be in trouble, if not fatally flawed.

/be


More information about the Es-discuss mailing list