let function

Alexander Jones alex at weej.com
Thu May 14 20:37:05 UTC 2015


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.

Cheers

On Thursday, May 14, 2015, Garrett Smith <dhtmlkitchen at gmail.com> wrote:

> On 5/14/15, Alexander Jones <alex at weej.com <javascript:;>> 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.
>
> http://www.ecma-international.org/ecma-262/5.1/#sec-12
>
> 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
> encountered.
>
> 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
> expressions demystified".
>
>
> > On Thursday, May 14, 2015, Bergi <a.d.bergi at web.de <javascript:;>>
> wrote:
> >
> >> Alexander Jones schrieb:
> >> > On Thursday, May 14, 2015, Domenic Denicola <d at domenic.me
> <javascript:;>> wrote:
> >> >
> >> >>   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
> >>> people
> >>> consider de facto by now!
> >>>
> >>> From V8:
> >>>
> >>>      SyntaxError: In strict mode code, functions can only be declared
> at
> >>> top
> >>> level or immediately within another function.
> >>>
> >>
> >> That's ES5. In ES6, function declarations are allowed in blocks - with
> >> the
> >> 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.
> >>
> >>  Bergi
> >> _______________________________________________
> >> es-discuss mailing list
> >> es-discuss at mozilla.org <javascript:;>
> >> https://mail.mozilla.org/listinfo/es-discuss
> >>
> >
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
> personx.tumblr.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150514/2dcc3d0b/attachment.html>


More information about the es-discuss mailing list