How can a lexer decide a token to be "get", "IdentifierName" or "Identifier" ?

gaz Heyes gazheyes at gmail.com
Tue Feb 5 00:19:38 PST 2013


On 4 February 2013 23:44, Brendan Eich <brendan at mozilla.com> wrote:

> What's confusing?
>

The fact that you can have an object property without a colon and a
function without a function keyword. Then a property descriptor uses a
completely new syntax to define the same thing. Why?
Object.defineProperty(window,'x',{set:alert});
x=1;

To me this seems hacked together.


> ({'get'x(){return 123;}}).x
>>
>
> That's not legal ES5.
>

Some engines support it though and I'm pretty sure Firefox did at some
point.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130205/c8bd1e9d/attachment.html>


More information about the es-discuss mailing list