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).
--Oliver On Jun 20, 2011, at 1:53 PM, Mike Samuel wrote: > I was mucking around with some tests of how interpreters deal with > identifiers whose decoded value is the same as a reserved keyword. > > Many interpreters seem to diverge wildly from the spec and from each > other w.r.t. encoded versions of the keyword "this". > > I don't see any relationship between the identifier "this" and > ThisBinding in the spec, so I believe the below tests should all pass. > Am I missing something? > > The testcases are available at > http://google-caja.googlecode.com/svn/trunk/doc/html/identifier-keyword-confusion.html > and are reproduced below for easy quoting: > > > assertTrue("this" === "thi\u0073"); > > (function () { > var thi\u0073 = 42; > assertFalse(this === 42); > assertTrue(thi\u0073 === 42); > }()); > > (function (thi\u0073) { > assertFalse(this === 42); > assertTrue(thi\u0073 === 42); > }(42)); > > (function thi\u0073() { > assertFalse("function" === typeof this); > assertTrue("function" === typeof thi\u0073); > }()); > > var called = false, bodyReached = false; > var \u0069\u0066 = function (x) { assertFalse(x); called = true; }; > > assertTrue("if" === "\u0069\u0066"); > > \u0069\u0066(false) > { > bodyReached = true; > } > assertTrue(called); > assertTrue(bodyReached); > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

