this vs thi\u0073

Geoffrey Sneddon gsneddon at opera.com
Tue Jun 21 01:59:22 PDT 2011


On 21/06/11 00:50, Luke Hoban wrote:
> 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."

There's also <http://wiki.whatwg.org/wiki/Web_ECMAScript#Identifiers> 
which states (after saying "this is very rough"):

"Identifiers containing escape sequences are not equivalent to fully 
unescaped identifiers in the case that, after fully unescaping 
identifier, it is a ReservedWord. In particular it is possible to create 
Identifiers that unescape to a reserved word so long as at least one 
character is fully escaped. Subsequent use of such identifiers must also 
have at least one character escaped (otherwise the reserved word will be 
used instead) but it need not be the same character(s) as that 
originally used to create the identifier."

-- 
Geoffrey Sneddon — Opera Software
<http://gsnedders.com>
<http://opera.com>


More information about the es-discuss mailing list