Is \u006eew a valid Identifier?
Mark S. Miller
erights at google.com
Mon Nov 9 19:06:23 UTC 2015
On Mon, Nov 9, 2015 at 12:05 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
> On Nov 9, 2015, at 6:55 AM, Andreas Rossberg <rossberg at google.com> wrote:
> Allen, what was the motivation for allowing random escapes in
> identifiers but not in keywords? AFAICS, it would be simpler and more
> consistent to allow them anywhere and render "escape normalisation" a
> uniform prepass before tokenisation. IIUC, that's what other languages
> do. The current ES rules are far from ideal, and require jumping
> through extra hoops, in particular, to handle context-dependent
> keywords like `yield`.
> Here are some references:
> there are many others, and also there were earlier TC39 meeting
> discussions that I didn’t find in my quick search.
> It’s a usability vs. implementor convience trade-off. the TC39 was to go
> with usability (and in particular readability).
> (Also, my recollection is that in some TC39 discussions (that I didn’t
> find in my search) there were security concerns raised WRT allowing unicode
> escapes in keywords. Probably concerns about code injection filters not
> recognizing escaped keywords)
This was extensively discussed. Consensus was reached and declared. Other
tools were then built that rely on these decisions. Let us not change these.
TC39 decided this the right way. Even if they did not, the arguments
against do not outweigh the arguments for stability and against spec
thrashing this late in the game. It is way too late to revisit this if the
counter-arguments are only moderate implementor inconvenience.
> In ES6 (and I believe that Waldemar would claim in previous editions)
> unicode escapes cannot be handled with such a prepass. Essentially, escaped
> and non-escaped *IdentifierName* characters are only equated when doing
> identifier binding or property name lookups. It’s probably a misperception
> of the lexical grammar and static semantics that leads some implementors
> down the path of thinking that such a preps is reasonable.
> Regarding `yield`, if it is written containing unicode escapes it is never
> a contextual keyword.
> BTW, personally I I would be just fine with never allowing unicode escapes
> within IdentiferName. But that would be a web breaking change.
Yes and yes.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss