Hacker News new | ask | show | jobs
by bdcravens 4669 days ago
Ignorant American here, asking of the non-native English speakers:

As most (every?) programming language is "in English", does this impair understanding? (for, in, throw, select, from - all English words whose meanings are more or less in line with the programming concept they define) (Even Ruby, created by a Japanese, is "English")

For those who write/type in languages that require Unicode: since you typically code in ASCII, was this a challenge to learn? (do modern languages support Unicode for things like variable names? I've never seen Hebrew, Chinese, etc code - does anyone have any examples?)

7 comments

Ruby 1.9 and 2.0 supports Unicode variables (1.9 requires a special line at the top of the file).

Outside of some cute usage of the Pi symbol (because he could) I haven't seen it used in the wild.

Most Japanese programmers I know / whose code I have seen just use the romaji text for their variables names if they are still thinking in Japanese. (i.e. "tesuto" instead of "test" or "yuza_banngo" for "user_id")

I remember ruby code circa 2001, there was a lot of it with kanji in in comments, which I found fascinating :)
When I was learning Basic in school, I wasn't really caring/realizing that all of the keywords can actually be translated to Russian, I was just learning them by heart like proper nouns. On the other hand, seeing languages with syntax in Russian (like the scripting language in 1C CRM) always makes me smile ("so ugly, unusual and funny").
When I learned Basic as a kid (8–9 years old I think), I just learned what the reserved words (rem, print, goto, gosub, return, if then else, etc.) did in the context of my programs: 'goto' literally meant "jump to this line" etc.

It was somewhat later that I realized that my 'goto' is actually derived from English words 'go' and 'to'.

So if goes like this:

- 8 yrs old: learn 'while' in the context of Basic

- 10 yrs old: learn 'while' in the context of English classes at school

- 14(?) yrs old: suddenly realize if you remove the space from then English "go to", it becomes the Basic 'goto', and a-ha, maybe that is not a coincidence.

I actually just right now realized what the 'wend' in the while...wend loop is made of (in the English sense). Hah.

Can't talk for everyone but I always use English in all my code for everything (Variables, Database, Filenames etc.) Because it's a real pain to be consistent otherwise. In the beginning I used to write parts of my code in German because I thought it would be easier to understand but it just made my life harder in the long run because I had to deal with inconsistencies all the time.

And after my initial trouble with some special characters like the French accents (é, è, à etc.) and the German umlauts (ä, ö, ü) I made myself do everything in ASCII.

General rule is: Code and back-end stuff 100% English and only basic ASCII characters. Front-end in UTF-8/LAT1 but when possible avoid placing special chars in code (example ü in HTML only as ü not as ü)

I'm taking this as a very tenous opportunity to quote a scene from The Simpsons where the country bumpkin character says:

"I only speak good ol' american, if it's good enough for Jesus it's good enough for me"

I know that many programming languages (for example C), have long had tokenizers that are non-English. So the language is the same, the words are different.
On a similar note Excel commands are probably the most infuriating thing since I learned programming fro me because they are all in the regional language in my case German and make no sense to me now. (Example IF is WENN in German)

It drives me nuts.

I remember in high school they simply used a header file that redefined the keywords of the language in french.

Something like "#define SI if" #define "TANT_QUE while" etc...

> do modern languages support Unicode for things like variable names?

They do, but there's not much point in taking advantage of it outside of string literals: you're risking someone whose environment isn't set up to handle it coming in and getting barfed over for... what marginal benefit, really?

I googled "unicode variable names" and got this: http://rosettacode.org/wiki/Unicode_variable_names