Allen's lambda syntax proposal

Eric Suen eric.suen.tech at gmail.com
Tue Dec 2 18:26:40 PST 2008


I really don't think prefix is neccessary, what about:

(a;b;c) {...}

or

(a:b:c) {...}

2nd one may have problem with '::' or TypedIdentifier in ES4.

Regards,

Eric Suen

----- Original Message ----- 
From: "Maciej Stachowiak" <mjs-2kanFRK1NckAvxtiuMwx3w at public.gmane.org>
Newsgroups: gmane.comp.lang.javascript.ecmascript4.general
To: "Brendan Eich" <brendan-4eJtQOnFJqFBDgjK7y7TUQ at public.gmane.org>
Cc: <es-discuss-4eJtQOnFJqFAfugRpC6u6w at public.gmane.org>
Sent: Tuesday, December 02, 2008 4:59 AM
Subject: Re: Allen's lambda syntax proposal


>
> On Nov 29, 2008, at 10:30 PM, Brendan Eich wrote:
>
>> At the TC39 meeting two weeks ago in Kona, we had a brief  bikeshedding 
>> discussion about lambda syntax and why it matters.  Observation: blocks in 
>> Smalltalk being lightweight means users don't  mind writing them for control 
>> abstractions, compared to JS functions  in ES3. In Smalltalk, ignoring JS, 
>> it's hard to beat [ and ] as  overhead, although one must count the message 
>> selector and its  punctuation too.
>>
>> Allen Wirfs-Brock put his proposal, which will not shock you who  know 
>> Smalltalk or Allen, on the whiteboard:
>>
>> // Instead of lambda (a, b, c) { ... }, why not:
>> { |a, b, c| ... } ?
>
> I like the brevity, but having the formals inside the block and in || 
> delimiters seems like it will look weird in an ECMAScript program. For 
> function declarations the parameters go in parentheses, and for calls 
> (presumably also for lambda calls), the arguments go in parens. If  brevity is 
> important, why not lift the lambda syntax from modern pure  functional 
> languages:
>
> \(a, b, c) { ... }
>
> That's backslash as a lambda operator. This has one more character  than your 
> version, but will make formals and parameters look the same  for functions, 
> lambdas, and calls, and will avoid putting the formals  inside the body which 
> I think is confusing and visually hard to scan.
>
> Regards,
> Maciej 




More information about the Es-discuss mailing list