Expression closures - use-cases for shortcut lambda syntax (blocks)

Brendan Eich brendan at mozilla.org
Sun Mar 18 09:12:55 PDT 2007


We've been writing int -> int when discussing the type system,  
because it's too painful (especially on a whiteboard) to write  
function(int):int.

When Dave suggested function (formals) expression, Jeff Dyer wanted  
something like => after the (formals) -- he suggested = at the time.

I think this clinches it. We have been circling around the design  
point of (formals) => assign-expr (you're right about not wanting  
comma to bind more tightly than =>) for a while. Using -> when C#  
uses => would just be gratuitous.

I would require parentheses around the formals, even when there is  
only one.

In a class, I'm not so keen on name(formals) => expression defining a  
method, given the lack of a binding form elsewhere.

/be

On Mar 18, 2007, at 8:47 AM, Vassily Gavrilyak wrote:

> Correction :-)
>> The only place where it doesn't work is type declaration.
> should be read as:
> It also works nicely with type declarations
>
> So something like this
> function map(mapper: (function (_:*, _:uint, _:Object):*),  
> thisObj:Object):Array
> will become this
> function map(mapper: (_:*, _:uint, _:Object) => *,  
> thisObj:Object):Array
>
> Regards,
> Vassily
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss




More information about the Es4-discuss mailing list