W3C home > Mailing lists > Public > www-archive@w3.org > February 2007

Reserved words in JS (Was: [XBL] Use of "public")

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 14 Feb 2007 20:27:22 +0000 (UTC)
To: Cameron McCormack <cam@mcc.id.au>
Cc: www-archive@w3.org
Message-ID: <Pine.LNX.4.62.0702142025460.4112@dhalsim.dreamhost.com>
On Wed, 14 Feb 2007, Cameron McCormack wrote:
>
> Cameron McCormack:
> > Unless I am mistaken, reserved words in ECMAScript don't apply when you 
> > are dereferencing an object. so "this.public.x" is fine.
> 
> I think you’re thinking of the so-called “contextually reserved
> identifiers”.
> 
>   >>> o = { 'public': 123 }
>   [object Object]
>   >>> o.public
>   org.mozilla.javascript.EvaluatorException: missing name after
>     . operator (System.in#2)

That doesn't seem to be ECMAScript 3rd edition compliant (ReservedWord is 
only not allowed for Identifier, and the "public" in "o.public" isn't an 
Identifier as far as I can tell). It's also not what happens when you run 
the above code in Mozilla's browser JS interpreter. Weird.

Oh well. Doesn't matter, change was made anyway.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 14 February 2007 20:27:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:18:02 GMT