[swift-evolution] Prohibit invisible characters in identifier names

Magnus Ahltorp map at kth.se
Fri Jun 24 17:21:02 CDT 2016

> 21 June 2016 16:48 Vladimir.S via swift-evolution wrote:
> On 21.06.2016 7:37, Charlie Monroe via swift-evolution wrote:
>>> On Jun 21, 2016, at 2:23 AM, Brent Royal-Gordon via swift-evolution
>>> <swift-evolution at swift.org> wrote:
>>>> 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.
>> Yes, but the SDKs (frameworks, system libraries) are all in English,
>> including Swift standard library. I remember a few languages attempting
>> localized versions for kids to study better, failing terribly because
>> you learned something that had a very very limited use.
> Support Charlie's opinion. For me (as non-native English speaker) non-ASCII characters in identifiers had no sense, even when I start to tech the programming when I was a child. Expressions composed from identifiers written in my native language is not near correct sentences.
> Even more, we still have all other parts of language in English - for-while-guard-let-var-func etc..

As far as I can see, forcing the programmer to write identifiers in an only-ASCII language, and requiring that identifier names have to be meaningful to the programmer means that the programmer has to know a language that is written in only ASCII. Most people are not, and requiring that they first learn for example English to be able to write programs is absurd.

Of course, if we relax the rule that identifier names have to be meaningful to the programmer, then it works out, but that is not something that I feel the Swift community should encourage.

The few symbols that are in English can be learned as what they are, symbols, without knowing their English meaning, just like &, |, <, >, *, and so on are symbols. In fact, you all learn these words as symbols that are distinct from their English connotations, since Swift is definitely not English text.


More information about the swift-evolution mailing list