return when desugaring to closures
brendan at mozilla.org
Thu Oct 9 14:31:58 PDT 2008
On Sep 2, 2008, at 2:16 PM, Lex Spoon wrote:
> On Sun, Aug 24, 2008 at 3:17 AM, Brendan Eich <brendan at mozilla.org>
>> First, let's settle the hash over whether any desugaring without
>> extensions such as return-to-label, reformed lexical scope, tamed
>> this, banished arguments, etc. etc., trumps adding a new binding
>> form, to wit: let as block scoped var.
> With no extensions, it is true, return would end up returning from a
> different method under the proposed rewrite. Likewise, this and
> arguments would cause trouble.
Sorry for the very tardy reply. You make good points in the abstract,
and the messy language-specific details of existing semantics for
functions not being clean enough deserves a better response than just
I stand by "don't desugar let to functions as-is". I'm also pretty
certain "don't add more modes or subsets to try to fix existing forms"
is sound, since versionitis does not help us either keep the spec
simple or specify the backward-compatible semantics in the full
So, to avoid trouble, we've been thinking of new forms including a
better function, call it lambda, that has none of the compatibility
baggage. I say "we" but really Dave Herman deserves credit for
championing this. A "lambda" form has been a topic now and then for a
while, on this list and in committee, and sometimes only as syntactic
sugar (which would miss the opportunity for semantic reform) -- yet
without it getting the breathing room it needs.
Dave is working now in the
space on the wiki. Don't throw stones, this is not in the harmony:
namespace for good reason. Constructive comments welcome. And I still
owe the list a story on wiki access that keeps Ecma happy and doesn't
throw open the edit wars doors.
Among the new strawman pages, the following are relevant and (I hope)
> Possibly break and continue would,
> depending on what their precise semantics are.
JS has break from labeled statement, and continue to labeled loop
bottom, a la Java. These look trouble-free to me. Let me know if you
see a hard case. Thanks,
More information about the Es-discuss