A new ES6 draft is available

Fabrício Matté ultcombo at gmail.com
Sat Jan 17 11:57:36 PST 2015

> Currently in ES6, the only reserved keywords that can appear immediately
before a `.` are `this` and `super`.

The `this` binding resolves to a value, so MemberExpressions make sense.
The `super` keyword is being implemented in ES6, so there are no precedents
to set expectations.

> Any other reserved word followed by a `.` is a syntax error.  So reserved
words followed by period and an identifier is  one of the few available
extension alternatives we have available.  And is a natural ready syntax
think of new.target' as meaning give me the target value of the currently
active `new` operator.

I agree `new.target` is very natural and pleasant to read. It just feels
rather alien to see an operator in the beginning of a MemberExpression,
which currently would only be allowed in this very specific scenario. Of
course, if this syntax extension form would be useful for other use cases
as Kevin and you have outlined, then I don't oppose it.

> I suspect the hypothetical naive JS programmer postulated above wound't
be aware of any of those concepts.

A naive one probably not, but a curious avid developer most definitely
would. ;)

> hopefully they will say what is `new.target', "google it" and immediately
find the answer.

You mean, land on a Stack Overflow answer with thousands of upvotes and
very little explanation about why/how a MemberExpression can begin with an
operator. Of course, if you interpret `new` as simply a ReservedWord token
instead of an operator, then everything makes perfect sense.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150117/6006fcd1/attachment.html>

More information about the es-discuss mailing list