Unicode Escape Sequences in Reserved Words

# Murat Sutunc (12 years ago)

According to the latest draft, it is allowed to express a ReservedWord using Unicode Escape Sequences: The ReservedWord definitions are specified as literal sequences of specific SourceCharacter elements. However, any code point in a ReservedWord can also be expressed by a \ UnicodeEscapeSequence that expresses that same Unicode code point. Use of such escape sequences does not change the meaning of the ReservedWord. Because of the last sentence the following should now give an error on all of the implementations:

var v\u0061r = 1 ; //err

However, if my understanding is correct, it will also enable the following usage:

v\u0061r x = 1 ; //works

The second example was also previously mentioned in the bug 277 but there's no clear resolution to it. Is the second example expected to work or are we just disallowing unicode escape sequenced keywords in identifier position?

# Allen Wirfs-Brock (12 years ago)

On Nov 3, 2013, at 9:55 PM, Murat Sutunc wrote:

Because of the last sentence the following should now give an error on all of the implementations:

var v\u0061r = 1 ; //err

However, if my understanding is correct, it will also enable the following usage:

v\u0061r x = 1 ; //works

Yes this is allowed by the ES6 draft as a var declaration. That draft allows consistent Unicode escaping in within all IdentifierName contexts (including keywords)

The second example was also previously mentioned in the bug 277 but there's no clear resolution to it. Is the second example expected to work or are we just disallowing unicode escape sequenced keywords in identifier position?

The resolution of bug 277 is reflected in the current ES6 draft. Note that 277 is an ES5.1 bug rather than an ES6 draft bug and its status relates to how me manage ES5 errata issues.