{this} object literal

Gary Guo xg244 at cam.ac.uk
Fri Apr 21 18:12:58 UTC 2017

Because the shorthand only requires an Identifer, and an IdentiferName is not sufficient. If the rule allows arbitrary IdentiferName, then we will also allow `{if}`, which makes no sense it all. So if we really want to allow this, it would be a special rule in addition to the current rule. In this sense, we are not forbidden the use of `{this}`, but instead we don't have the rule to allow that.

From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of Michał Wadas <michalwadas at gmail.com>
Sent: Friday, April 21, 2017 6:01:37 PM
To: es-discuss at mozilla.org
Subject: {this} object literal


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170421/e94c905c/attachment.html>

More information about the es-discuss mailing list