Allen's lambda syntax proposal

Brendan Eich brendan at
Sat Dec 6 21:29:10 PST 2008

On Dec 6, 2008, at 9:19 PM, Peter Michaux wrote:

> On Sat, Dec 6, 2008 at 7:51 PM, David-Sarah Hopwood
> <david.hopwood at> wrote:
>> 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) ...;
> Does "const" have "var" or "let" scoping...or is it even a declaration
> at all? Although it is bulky it might be better to write "const var"

No, const var is an oxymoron.

> and "const let". A variable being constant or not is orthogonal to its
> scoping and should be controlled independently.

The preferred approach is to make let and const have the same binding  
scope, namely block, and leave var alone.

>> let name = lambda(formals) ...;
> I mentioned this a while back. I think it might be a good idea.  
> Scheme has
> (define foo (lambda (a b) 1))
> (define (foo a b) 1)
> which could be translated to ES
> var foo = lambda(a, b) 1;
> var foo(a, b) 1;

I still think this is bad form. A compound that does not create a  
variable that *must* denote the defined function some time later (via  
eval, arguments aliasing, hidden assignment if this is global code,  
etc.) misstates what is usefully meant by the proposed syntax.

JS is not Scheme, and while you could argue assignment is like set!  
the binding forms (including var extensions, but especially function,  
const, and let) should have more definite and (under a strict mode or  
future version) immutable meaning.


More information about the Es-discuss mailing list