Language: Are there any plans to support Unicode as a variable name?

Created on 2 Nov 2020  ยท  9Comments  ยท  Source: dart-lang/language

Are there any plans to support Unicode as a variable name?

request

Most helpful comment

I'm fairly sure pictographic characters are not considered identifier characters, so I wouldn't expect var ๐ŸŽ„ = ๐ŸŒฒ + โญ ; to become reality. Too bad, var ๐Ÿฆ„ ๐ŸŒˆ = false;.

All 9 comments

cc @lrhn

No current plans, no.

It's not an unreasonable idea, but it has also not been a big priority. It will affect parsing time (currently non-ASCII characters can only occur inside comments and string literals in a valid Dart program, which makes tokenization simpler. It doesn't have to recognize whether a sequence of bytes is a Unicode identifierStart/identifierPart or not, something which requires a potentially large table to figure out).

I'm looking forward to name my variables with emojis.

I'm fairly sure pictographic characters are not considered identifier characters, so I wouldn't expect var ๐ŸŽ„ = ๐ŸŒฒ + โญ ; to become reality. Too bad, var ๐Ÿฆ„ ๐ŸŒˆ = false;.

I specifically think we should not support arbitrary Unicode letters in identifiers. There are too many homoglyphs which can make code confusingly wrong at best or mask deliberate security bugs at worst.

I specifically think we should _not_ support arbitrary Unicode letters in identifiers. There are too many homoglyphs which can make code confusingly wrong at best or mask deliberate security bugs at worst.

Sounds like a problem area indeed, but on the other hand, it would only be the concern to those developers choosing to use non-ascii identifiers. Have you ever run into this issue @qcks in another programming language, and if so, how do you tend to avoid this?

I specifically think we should _not_ support arbitrary Unicode letters in identifiers. There are too many homoglyphs which can make code confusingly wrong at best or mask deliberate security bugs at worst.

Sounds like a problem area indeed, but on the other hand, it would only be the concern to those developers choosing to use non-ascii identifiers. Have you ever run into this issue @qcks in another programming language, and if so, how do you tend to avoid this?

Simply put, the variable names are long and smelly.

I want to have that characteristic

it would only be the concern to those developers choosing to use non-ascii identifiers.

The way developers work today with massive open source ecosystems, package managers, and deep dependency graphs, we are all using lots of lots of code that we don't have much control over.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcelgarus picture marcelgarus  ยท  3Comments

eernstg picture eernstg  ยท  5Comments

jonasfj picture jonasfj  ยท  3Comments

natebosch picture natebosch  ยท  4Comments

har79 picture har79  ยท  5Comments