Block lambda is cool, its syntax isn't

Brendan Eich brendan at mozilla.com
Wed Jan 18 12:00:44 PST 2012


> Oliver Hunt <mailto:oliver at apple.com>
> January 18, 2012 11:45 AM
> On Jan 18, 2012, at 11:41 AM, Brendan Eich wrote:
>
>> Not so -- I do not love Ruby. Also, this is essentially an _ad 
>> hominem_ argument. 
>
> Many apologies, the ':)' was meant to imply that a knew that that wasn't a valid argument

Sure, I saw that -- just trying to stick up for myself as a non-lover of 
Ruby.

I think TCP is worth including in JS in a new special form. We've been 
talking about this since 2008 at least:

https://mail.mozilla.org/pipermail/es-discuss/2008-November/008216.html

Anything we on this front is a new special form. We won't make a 
migration barrier or dialect/version fork and inflict TCP on functions. 
So then the issue is what concrete syntax might be best.

Looking at other languages is one way to hedge against the proven 
ability of any language designer to mistake the original for the good. 
Ruby's syntax has some basis in Smalltalk, but not much. Ruby is known 
to some JS developers but not all. There's some win here, but not 
decisive win.

Independent of Ruby, we've argued about other syntaxes, most recently 
{(params) body}, and everyone I saw champion that syntax came back to 
pipes to better distinguish the new special form from both functions and 
juxtaposed parenthesized expressions and block statements.

The fact that block-lambdas use the same {|params| body} syntax as Ruby 
in what I'm proposing is thus not an argument from authority (Matz's or 
other Rubyist's). The proposed syntax does not have anything to do with 
"love of Ruby" as in "willing the good of Ruby" (to use a sound 
definition of "love"). It has everything to do with loving JS *assuming* 
we want a TCP-conforming lambda special form.

/be



More information about the es-discuss mailing list