Why UTF-8/16 character encodings?

Michel Fortin michel.fortin at michelf.ca
Tue May 28 07:25:30 PDT 2013


On 2013-05-28 01:34:17 +0000, Walter Bright <newshound2 at digitalmars.com> said:

> On 5/27/2013 6:06 PM, H. S. Teoh wrote:
>> I don't find this a compelling reason to allow full Unicode on
>> identifiers, though. For one thing, somebody maintaining your code may
>> not know how to type said identifier correctly. It can be very
>> frustrating to have to keep copy-n-pasting identifiers just because they
>> contain foreign letters you can't type. Not to mention sheer
>> unreadability if the inventor's name is in Chinese, so the algorithm
>> name is also in Chinese, and the person maintaining the code can't read
>> Chinese. This will kill D code maintainability.
> 
> +1

-1

What's even worse for code maintainability is code that does not do 
what it says.

Disallowing non-ASCII charsets does not prevent people from writing 
foreign-language code. I've seen plenty of code in French in my life in 
languages with no Unicode support. I've also seen plenty of bad English 
in code. I'd rather see a correct French word as a variable or function 
name than an incorrect English one. Correctly naming things is 
difficult, and correctly naming them in a foreign language is even 
more. This surely apply to languages using non-ASCII alphabets too.

Of course, if you're not using English words you'll be limiting 
audience to programmers who understand that language. But you might 
widen it in other directions. I worked once with a grad student who was 
building a model to simulate breakages of water pipe systems. She was 
good enough to write code that worked, although she needed my help for 
a couple of things, notably increasing performance. The code was all in 
French, and thankfully so as attempting to translate all those terms 
(some dealing with concepts unknown to me) to English when writing the 
code and back to French when explaining the concepts would have been 
quite annoying, inefficient, and error-prone in our work.

While French likely will always be a possibility (as it fits well in 
ASCII), I can see how writing code in Japanese or Russian might benefit 
native speakers of those languages too, especially those for who 
programming is only an incidental part of their job. Programming is a 
form of expression, and it's always easier to express ourself in our 
own native language.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list