return when desugaring to closures
Mark S. Miller
erights at google.com
Sat Oct 11 13:21:40 PDT 2008
On Sat, Oct 11, 2008 at 12:52 PM, Peter Michaux <petermichaux at gmail.com> wrote:
>> Use let (the var replacement declaration form).
> Sounds good to me but it is a little confusing to keep track if "let"
> is either in or out of ES-Harmony and if it is partly in then which of
> "let*", "letrec" semantics.
The let declaration is in. Like const and function declarations, it
has block-level letrec lexical scoping. I continue to oppose let
expressions and let statements, as they don't provide enough
additional power to justify their cost. For example, if lambda
supports optional args, as I think we all agree it should, then,
adapting a suggestion of Lars, we should define the scope in which the
default value expressions are evaluated so that
var x = 2;
(lambda (x = 3, y = x) (x+y))()
returns 5, not 6. This gives us an easy enough let. The builtin let
declarations provide an easy letrec. Given these, no one will miss
More information about the Es-discuss