revive let blocks

Rick Waldron waldron.rick at gmail.com
Thu Jun 18 15:30:49 UTC 2015


On Thu, Jun 18, 2015 at 9:54 AM Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 6/18/15 9:01 AM, Kyle Simpson wrote:
> > In addition to the fact that this feature is long since co-existing in
> FF and doesn't seem to have broken the web
>
> Firefox doesn't ship let support on the web by default yet.  For
> example, this HTML:
>
> <script>let x = 5;</script>
>
> will result in:
>
>    SyntaxError: missing ; before statement
>
> at the location of the 'x'.
>

Strange, this works in the console, but not in a script
https://i.gyazo.com/e55d26495c3fe8b01938fe1b99664682.png



>
> You have to explicitly opt in to let support in Firefox right now via
> language="javascript1.8" or similar.
>

More importantly, the only reason `let (names) {}` "co-exists" in those
special opt-in versions is because `let` is not allowed as an identifier.
The issue that Gary Guo pointed out is a very real breaking change for the
web.

Using language="javascript1.8" will make all of these result in
SyntaxError:

  var let = 1;
  var let = function() {};
  function let() {}
  let(1);

Otherwise this would be ambiguous:

  let (a)
  {}

Adding this non-standard restriction prevented authors from using `let` as
an identifier.

I wonder if some application of `[no LineTerminator here]` might make this
work? Is it worth it?

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150618/4fe9c8b7/attachment-0001.html>


More information about the es-discuss mailing list