return when desugaring to closures

Mark S. Miller erights at google.com
Wed Oct 15 13:28:56 PDT 2008


On Wed, Oct 15, 2008 at 12:31 PM, Dave Herman <dherman at ccs.neu.edu> wrote:
> Do you prefer (lambda Formals Block | lambda Formals Expression)?
> [Personally I'm fine with that.] Or do you oppose any lambda expressions
> at all? Or did you have something else in mind?

My preference is

    "lambda" Formals? Block

Since an invocation of the closure evaluates to its completion value,
the only savings of introducing the Expression form would be a pair of
curlies. This is too small a benefit to justify another case in the
grammar. Further, in exchange for always requiring the curlies, we can
make the formals optional. Once we've got lambda, we'll start using
them for control abstractions, in which case the no-parameter form
will become quite common. I'd rather be able to leave out the parens
than the curlies. YMMV. This is admittedly subjective, but you did ask
about preferences.

-- 
    Cheers,
    --MarkM


More information about the Es-discuss mailing list