return when desugaring to closures

David-Sarah Hopwood david.hopwood at
Fri Oct 10 04:26:44 PDT 2008

Peter Michaux wrote:
> This keyword/scoping problem must already have appeared for functions
> as function declarations have "var" scoping and obtaining "let"
> scoping requires using something like "let a = function(){}". This is
> pretty ugly for functions to have "let" scoping but the good news is
> the door has been left open for real lambdas to snatch up the
> available "var a(){}" and "let a(){}" syntaxes.

... and "const a(){}" or "let const a(){}", which are what you would
want in preference to "var" or "let" in the majority of cases for
function definitions.

(Is it just me, or is "let const" as proposed in
a bit too verbose? E uses "def" for constant declarations, and IMHO
it does matter that this is just as concise as "var".)

David-Sarah Hopwood

More information about the Es-discuss mailing list