let and strict mode

Kevin Smith khs4473 at gmail.com
Fri Nov 16 10:38:54 PST 2012

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

If let is a contextual keyword (in non-strict mode of course), then we can
look ahead to the token after `let` to validate it.  An open paren cannot
follow a let *keyword*, so therefore it must be an identifier.

   var let = { it: "be" };
>     let.it // be

Same logic applies.  A dot cannot follow a let keyword so we parse it as an

On the other hand, an open square bracket *can* follow a let keyword (by
array destructuring), so we have a potential ambiguity there.

- Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121116/c945ad35/attachment.html>

More information about the es-discuss mailing list