Question about allowed characters in identifier names

Norbert Lindenberg ecmascript at
Thu Sep 5 10:37:12 PDT 2013

On Sep 5, 2013, at 1:06 , Mathias Bynens <mathias at> wrote:

> On 26 Aug 2013, at 04:08, Norbert Lindenberg <ecmascript at> wrote:
>> On Aug 24, 2013, at 23:43 , Mathias Bynens <mathias at> wrote:
>>> 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')`
>> What would be the use case(s) for that?
> Tools like

I see nothing on that page about identifiers.

>> Would it accept only an actual identifier or all possible escaped forms of one (i.e., only "𠮷野家" or also "\u{20BB7}野\u5BB6")?
> Both, since `"𠮷野家" === "\u{20BB7}野\u5BB6"`. That string is also equal to `"\uD842\uDFB7\u91CE\u5BB6"` although it hasn’t been decided if that should be a valid identifier too (since it uses the surrogate code points explicitly): <>. That complicates things.

The question is about the purpose of the function: Should isIdentifier just help with character classification, or with parsing and unescaping as well? Without real use cases, we can't decide. Note that String methods in general don't know anything about Unicode escapes - those are handled by the ECMAScript or JSON parsers.


More information about the es-discuss mailing list