Ron.Buckton at microsoft.com
Thu May 14 20:55:49 UTC 2015
I proposed something similar to this among the folks investigating decorators for ES7:
In this case, it was for a `const function`, as a means to allow a decorator on a function declaration, as adding the `const` (or `let`) would introduce TDZ and set the right expectations for how decorators would be executed.
From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Alexander Jones
Sent: Thursday, May 14, 2015 1:37 PM
To: Garrett Smith
Cc: Bergi; es-discuss at mozilla.org
Subject: Re: let function
Good points. All the more reason to throw out declarations as statements in favour of let/const/var, which we all have to understand well anyway, for other types of variable.
On Thursday, May 14, 2015, Garrett Smith <dhtmlkitchen at gmail.com<mailto:dhtmlkitchen at gmail.com>> wrote:
> Ah, thanks for explaining! What about the Temporal Dead Zone of let,
> or const binding semantics, for those of us who are obsessive enough to
> desire that kind of thing everywhere?
Let a constructive discussion about this proposal take place.
"The specification," can most reasonably be taken among programmers to
mean "the latest version of specification" not "draft specification"
or "proposal". Evangelists and standards geeks tend to miscall "draft"
"specification" to the misfortunate effect that it misleads developers
into believing that drafts are normative, final, etc. That's quite a
bit worse than the abrasiveness and confusion seen here, but hopefully
they can stop and a discussion can take place.
Because of these irreconcilable differences, the use of a
FunctionDeclaration as a Statement results in code that is not
reliably portable among implementations. It is recommended that
ECMAScript implementations either disallow this usage of
FunctionDeclaration or issue a warning when such a usage is
The decision for such wording probably came from discussions and time
constraints of getting ES5 done. The problem of FunctionDeclaration
arose from implementations in JScript (see "[MS-ES3EX]" and language
extensions in Spidermonkey and others. It progressed to misstatements
in presentations and books. For more on this, see "Named function
>> Alexander Jones schrieb:
>> >> They can, in fact, be scoped in a for loop.
>>> That's not what I see, in strict mode at least, which I assume most
>>> consider de facto by now!
>>> From V8:
>>> SyntaxError: In strict mode code, functions can only be declared at
>>> level or immediately within another function.
>> That's ES5. In ES6, function declarations are allowed in blocks - with
>> new block scope semantics. This was only possible as ES5 strict mode held
>> that spot open so now it doesn't break anything :-)
>> Yes, it will need a while until people get accustomed to that.
>> es-discuss mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss