Expression closures - use-cases for shortcut lambda syntax(blocks)
jodyer at adobe.com
Sun Mar 18 12:33:51 PDT 2007
> We've been writing int -> int when discussing the type system,
> because it's too painful (especially on a whiteboard) to write
> 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 :) Maybe requiring parens is better; why have two ways
to write something when one will do! Also, for now let's not extend this
syntax to binding forms, inside or outside of a class. I have concerns
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.
Thanks to Vassily and others on es4-discuss for picking up the ball when
we drop it.
More information about the Es4-discuss