2011/6/20 Oliver Hunt <[email protected]>:
> 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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to