My read of the spec is that thi\u0073 is a ReservedWord and should not be 
allowed as an Identifer.  So the following part of the examples quoted below 
should be an early error:

  var thi\u0073 = 42;

The text in 7.6 seems to address this with:

"All interpretations of identifiers within this specification are based upon 
their actual characters regardless of whether or not an escape sequence was 
used to contribute any particular characters."

Luke

-----Original Message-----
From: es-discuss-boun...@mozilla.org [mailto:es-discuss-boun...@mozilla.org] On 
Behalf Of Mike Samuel
Sent: Monday, June 20, 2011 2:18 PM
To: Oliver Hunt
Cc: es-discuss
Subject: Re: this vs thi\u0073

2011/6/20 Oliver Hunt <oli...@apple.com>:
> Without looking at the spec but just based on what I know our lexer (JSC) 
> does, we won't consider any identifier with escaped characters to be a 
> keyword, so yes you could make identifiers that technically match language 
> keywords, but you'd never be able to use them directly (without escaping).

You can due to global object aliasing.

  var thi\u0073 = 42;
  alert([this.this === 42,  // Look ma, no escaping!
          this["this"] === 42]);  // Look ma, still no escaping!

works in Firefox.

The first is legal because MemberExpression is defined as
     MemberExpression . IdentifierName
not
     MemberExpression . Identifier
and it is only Identifier that is not allowed to be a reserved word
     Identifier :: IdentifierName but not ReservedWord
     IdentifierName :: IdentifierStart
          | IdentifierName IdentifierPart 
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to