Allen's lambda syntax proposal

Rob Arnold tellrob at gmail.com
Tue Dec 2 22:17:28 PST 2008


2008/12/2 Brendan Eich <brendan at mozilla.com>

> This loses almost all connection with the rest of the language. Arguments
> are passed in a comma separated list. Wrapped in parentheses. The Smalltalk
> *hommage* loses the parens but keeps the commas. Any other separator is
> just wrong, sorry.
>
> C# uses (a, b, c) => ... but in JS the comma operator makes that nasty to
> parse top-down. I think the only candidates have to be of the form
>
> ^(a, b, c) {...}
>
> (^ could be another character, but it seems to beat \ as others have
> noted), or else the Smalltalky
>
> { |a, b, c| ... }
>
> At this point we need a bake-off, or a convincing argument against the
> unusual vertical bar usage.
>
> /be
>
>
The double bar syntax looks ok except when there are no arguments since it
then looks like logical or which is confusing to my eyes. And when there is
just a space between them, it looks awkward as well.

I like the idea of a short prefix (shorter than lambda), but there aren't
any single character symbols that don't already have meaning somewhere else
it seems.

With these two points in mind, I'd like to propose using the SML syntax for
lambdas. This introduces a new keyword but it is only two characters and I
think it better describes what is going on than ^ or some other character.
There are probably other short 2 letter keywords that would work as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20081203/3bd944f3/attachment.html>


More information about the Es-discuss mailing list