[swift-evolution] Prohibit invisible characters in identifier names

Brent Royal-Gordon brent at architechies.com
Mon Jun 20 19:23:24 CDT 2016


> Perhaps stupid but: why was Swift designed to accept most Unicode characters in identifier names? Wouldn’t it be simpler to go back to a model where only standard ascii characters are accepted in identifier names?

I assume it has something to do with the fact that 94.6% of the world's population speak a first language which is not English. That outweighs the inconvenience for Anglo developers, IMHO.

Honestly, this seems to me like a concern for linters and security auditing tools, not for the compiler. Swift identifiers are case-sensitive; I see no reason they shouldn't be script-sensitive or zero-width-joiner-sensitive. (Though basic Unicode normalization seems like a good idea, since differently-normalized strings are `==` anyway.)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list