return when desugaring to closures

Peter Michaux petermichaux at gmail.com
Sat Aug 23 20:36:57 PDT 2008


On Sat, Aug 23, 2008 at 7:15 PM, Brendan Eich <brendan at mozilla.org> wrote:
> On Aug 22, 2008, at 4:02 PM, Lex Spoon wrote:

>> So is there anything that is really an issue with the proposed
>> desugaring?
>
> Of course. First, it's unnecessary and confusing to have two ways to
> write
>
> (function (x, y) {...})(a, b)

That statement seems like an anti-sugar statement in general which I
don't think you are, are you? (I don't think I'm quoting that
statement out of context.)

If you do think some sugar is ok, where do you draw the line? How much
boilerplate needs to be eliminated to make the sugar sweet enough?

--------

If no new semantics are added to JavaScript then certainly having
sugar for writing

(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.

If the problem JavaScripters are trying to solve with that pattern is
addressed by adding new semantics then that is a different story.

Peter


More information about the Es-discuss mailing list