Allen's lambda syntax proposal

Brendan Eich brendan at mozilla.com
Mon Dec 1 10:24:48 PST 2008


On Dec 1, 2008, at 10:17 AM, Peter Michaux wrote:

> On Mon, Dec 1, 2008 at 7:31 AM, P T Withington <ptw at pobox.com> wrote:
>> On 2008-11-30, at 01:30EST, Brendan Eich wrote:
>>
>>> // Instead of lambda (a, b, c) { ... }, why not:
>>> { |a, b, c| ... } ?
>>
>> I would rather have a more literate syntax, lest we degenerate to  
>> where
>> practically any comic book blasphemy is a valid program.
>
> I agree with this sentiment. The phrase "ASCII vomit" comes to mind
> and becomes a worry.

I don't think it's a big worry. It seems to me ES3 (never mind new  
syntax) is far from Perl, but not nearly Python or an even more  
pedagogical language in which

     There should be one-- and preferably only one --obvious way to do  
it.

There are already several ways to say the same thing, for many values  
of "thing", in JS.


> Take an ES program and replace all if-else with ?: and then most
> functions with {||} and it starts to look quite cryptic.

But functions remain. I doubt lambdas in any synax will replace them.


> A reader would have a difficult time even knowing what to look up in a
> book index to find out what the {||} that they see in some code is
> supposed to be. It wouldn't necessarily be clear that the {} and the
> || are related.

A novice reader, you mean. Readers who know the language may prefer  
brevity. This is not a simple "read over write" optimization issue.

/be

>
>
> Peter
> _______________________________________________
> Es-discuss mailing list
> Es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the Es-discuss mailing list