Question about allowed characters in identifier names

Norbert Lindenberg ecmascript at lindenbergsoftware.com
Thu Sep 5 15:06:46 PDT 2013


On Sep 5, 2013, at 10:40 , Mathias Bynens <mathias at qiwi.be> wrote:

> 
> On 5 Sep 2013, at 19:37, Norbert Lindenberg <ecmascript at lindenbergsoftware.com> wrote:
> 
>> On Sep 5, 2013, at 1:06 , Mathias Bynens <mathias at qiwi.be> wrote:
>> 
>>> On 26 Aug 2013, at 04:08, Norbert Lindenberg <ecmascript at lindenbergsoftware.com> wrote:
>>> 
>>>> On Aug 24, 2013, at 23:43 , Mathias Bynens <mathias at qiwi.be> 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 http://mothereff.in/js-escapes.
>> 
>> I see nothing on that page about identifiers.
> 
> Sorry, wrong link. I meant this one: http://mothereff.in/js-variables

That's a nice page! But I doubt that developers will create such tools often enough to make a convenience function in the standard worthwhile. I proposed isIdentifierStart and isIdentifierPart because recognizing identifier characters across ECMAScript and Unicode versions requires large data tables; implementing the unescaping rules and filtering reserved words isn't all that hard.

Norbert


More information about the es-discuss mailing list