Question about allowed characters in identifier names

Mathias Bynens mathias at
Sat Aug 24 23:43:28 PDT 2013

On 25 Aug 2013, at 04:17, Norbert Lindenberg <ecmascript at> wrote:

> I don't think that's a technical problem. String.isIdentifier{Start,Part}, as I proposed them, don't deal with actual identifiers in source text; they check individual identifier characters.
> The functions are intended to be called by a parser, and it's up to the parser to deal with escaping rules, throwing exceptions or unescaping as specified before passing code points to String.isIdentifier{Start,Part}. Calling the functions with string literals doesn't seem like a useful use case.

Ah, I see. Step 1 of the proposed algorithm in would convert the string to a single code point. Thanks for clarifying!

I would suggest adding something like `String.isIdentifier` which accepts a multi-symbol string or an array of code points to the strawman. Seems useful to be able to do `String.isIdentifier('foobar')`

> I do think it's a problem in learning and understanding the language. Having different rules for \uD87E\uDC00 in string literals and identifiers, and therefore also for identifiers embedded in strings passed to eval(), adds yet another of those random inconsistencies that already litter ECMAScript, and ensures a "wat" moment for everybody who comes across them.


More information about the es-discuss mailing list