return when desugaring to closures

Mark S. Miller erights at google.com
Sat Aug 23 22:23:50 PDT 2008


On Sat, Aug 23, 2008 at 8:36 PM, Peter Michaux <petermichaux at gmail.com> wrote:
> (function (x, y) {...})(a, b)
>
> would be quite welcome. It is clear people like this pattern and it is
> confusing when the formals and actuals are more than a couple and more
> than a couple lines apart.

As Lars pointed out, using ES-Harmony's optional parameters with
defaults, you can keep the actuals and formals together by writing

    (function (x=a, y=b){...})()

Given this, I don't see any need for let blocks or let expressions
that justifies their added complexity. Especially since, as we've
established, they can't be added as sugar that desugars to anything
like the above code.

-- 
    Cheers,
    --MarkM


More information about the Es-discuss mailing list