[swift-evolution] Prohibit invisible characters in identifier names
charlie at charliemonroe.net
Fri Jun 24 23:13:08 CDT 2016
> On Jun 25, 2016, at 12:21 AM, Magnus Ahltorp <map at kth.se> wrote:
>> 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.
You can always write your identifier using ASCII. For languages that use the latin script, just extended with various accents, can be written without them (this is how I was taught). Any language I'm aware of can be eventually written in the latin script (Chinese, cyrilic, ...).
BTW how far along with programming do you think you'd get without the knowledge of English? All libraries, SDKs use English identifiers. The documentation is in English. For one to lear programming without actually knowing any English would require the language to have localizable identifiers. Can you imagine those? Given how much time is put here to standardize the naming of a few methods in the standard library, how would it look in other languages?
> 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