{this} object literal

Claude Pache claude.pache at gmail.com
Fri Apr 21 18:13:13 UTC 2017

More generally, all keywords are excluded, that makes sense in general as, e.g., `{ if }` could not be equivalent to `{ if: if }`, or `{ yield }` inside a generator function should not be equivalent to `{ yield: yield }`.

But yes, one could have special-cases for literals such as `this`, `true`, `false` and `null`. It is an accident of history that `{ NaN }` and `{ undefined }` work as expected, but not `{ null }`.


> Le 21 avr. 2017 à 19:01, Michał Wadas <michalwadas at gmail.com> a écrit :
> Hi.
> Is there any specific reason why {this} literal is forbidden? Babel had a bug allowing this and it was pretty convenient to enter console.log({this, arguments, externalVar}) for quick printing scope.
> Michał Wadas
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170421/5728a58c/attachment.html>

More information about the es-discuss mailing list