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

Vassily Gavrilyak gavrilyak at gmail.com
Sun Mar 18 13:03:23 PDT 2007


On 3/18/07, Jeff Dyer <jodyer at adobe.com> wrote:
> > 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.
>
> I like it, and agree with the details as captured here. I could go
> without the parens around a single formal, but I've been writing a lot
> of ML code lately :)
Now you can rewrite this code directly in ES, it will look better ;-)
>Maybe requiring parens is better; why have two ways
> to write something when one will do!
Maybe, maybe not, no clear winner here for me.
Omitted parens looks better, but special case is worse.
> Also, for now let's not extend this
> syntax to binding forms, inside or outside of a class. I have concerns
> about readability.
It seems everybody agreed on this.Probably getters-setters will look
better with shortcut, not sure.

> I'll update the parser in the next day or so to see if we've overlooked
> any issues. I don't expect we have.
>
> > > So, does such syntax have a chance to be in ES?
> >
> > I think so.
>
> Me too.
>
> Thanks to Vassily and others on es4-discuss for picking up the ball when
> we drop it.
>
> Jd
>
My big thanks to you Jeff and everybody participated in discussion.

Vassily Gavrilyak



More information about the Es4-discuss mailing list