return when desugaring to closures

Mark S. Miller erights at
Sat Oct 11 14:37:40 PDT 2008

On Sat, Oct 11, 2008 at 9:11 AM, Peter Michaux <petermichaux at> wrote:
> I think it would be ok to have only unnamed lambdas. (It would be ok
> to have named lambdas too.)

I think we should not introduce named lambdas because then we'd need
to decide whether the scoping of a lambda name works the same as the
scoping of a function name. Do we really want to reproduce the
following confusions:

* Distinction between named function expressions vs named function declarations?
* The name of a name function expression is only in scope within the
function, whereas the name of a named function declaration is in
(letrec) scope in the containing block.
* Because these look the same, a named function expression cannot be
used naked as the start of an expression statement. It must wear
protective parentheses.
* For consistency, an anonymous function expression also cannot be
used as a naked as the start of an expression statement.

If lambdas had optional names, we would either need to reproduce the
above confusions or deviate from them. Either choice is terribly


More information about the Es-discuss mailing list