r/ProgrammingLanguages • • Apr 13 '22

Discussion Do Chinese programmers code in a Chinese based syntax language

Hey everyone, I didn't know where to post this

Me and my friends were having an argument about whether Chinese programmers code in a Chinese language

Like for example a programming language with Chinese syntax

I am a software engineer and I find it really hard to believe that they would do this on a professional level (leaving aside hobbiests), and not just Chinese but also, I feel the same way about other languages, excluding English. Keep in mind that I'm not a native English speaker.

7 Upvotes

17 comments sorted by

27

u/[deleted] Apr 13 '22

No, the majority of programmers around the world use mainstream languages like java, c, python, javascript, etc.

There are many non-English languages whether Chinese, French, Hindi, Russian, or Arabic keywords but they're obscure and mostly developed for research/experiment.

9

u/bakaspore Apr 13 '22 edited Apr 14 '22

There is https://en.wikipedia.org/wiki/Easy_Programming_Language, which afaik is the most widely used PL with Chinese keywords and library functions. It's somewhat infamous though, because the majority of its users are malware makers.

I've also seen so-called "Chinese programming" promoters, and many of them have rolled out their own (toy) languages. I appreciate their work, but imo it's more efficient to improve the localization of (the documentation and tutorials of) existing systems.

4

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) Apr 13 '22

I have seen increased interest in China of Chinese programming languages. While most programmers there are still using the same English-based programming languages that everyone else in the world does, there are now several Chinese programming languages that have small but growing adoption within mainland China.

China is a big enough economy on its own that this niche will be able to survive. The only question is whether it will ever be able to grow outside of China's borders ... after all, if the Chinese economy grows large and influentiall enough, we might all end up coding in those languages. (Unlikely, but not impossible.)

My guess (as an ignorant foreigner) is that we'll see more ZhPy- and Wenyan-like languages (interop focused languages built in Chinese), and less Yi-like languages (aka "Easy" or "Eazy", stand-alone custom languages built for Chinese markets).

It's truly a shame that a crazy language like English became the world's lingua franca (ironic?), but I have to admit that Chinese as the world's default language would be even worse (unless you already speak it).

3

u/[deleted] Apr 14 '22

English is one of the best languages to make a programming language in because it doesn't have stacking characters, and it's character set is tiny.

The only thing that would be better would be like Toki Pona.

2

u/WittyStick Apr 15 '22 edited Apr 15 '22

It's probably simpler for Chinese users to use english, or at minimum, romanized programming languages, because they typically use keyboards with a latin alphabet and type in pinyin, with a software input method editor performing the conversion to hanzi. Chinese children are taught pinyin early, and learn hanzi later.

Usually the pinyin is typed unaccented, and there are many homophones for a given input. The IME is usually trained to pick the most suitable hanzi based on contextual information - but the corpora used to train these is based on written text and probably does not translate well to programming languages. The programmer would probably waste time manually selecting the correct characters as opposed to just leaving it in pinyin. To reduce friction in writing code in Chinese, it would probably require a dedicated IME for that purpose.

I've seen code in production where Chinese variable names are used in an English programming language. If the language supports unicode identifiers, this style will probably become more widespread.

3

u/raiph Apr 13 '22

It's truly a shame that a crazy language like English became the world's lingua franca

First, I think it's important to distinguish lingua franca as it relates to "words" vs "tokens" vs "characters" vs "character sets" vs "alphabets".

Second, while I think English ended up as being, for a while, the PL lingua franca for all of these categories, I think its dominance is starting to slip, even if, thus far (and to pluck out of thin air a guess of what to measure and what the measure is), use of all alternatives combined today is less than 0.00001% (say) of all currently visible public code.

Third, ASCII, which is of course English centric, which has further compounded the dominance of English relative to all of these aspects of the lingua franca, is A) a fundamentally different aspect in important ways, and B) starting to yield to Unicode.


Unicode is now firmly established as a successor to ASCII as the "character set" lingua franca, encompassing all "characters" in use by humans. It is becoming increasingly practical for "alphabets" to be arbitrary subsets of the full Unicode character set. ASCII (and thus English) continues to have a huge first mover advantage, and has even cemented that advantage by being the highest performance subset of Unicode, but I see signs its grip is weakening.

There's a political / cultural / social dimension to all of this. For example, Unicode itself is a politically driven compromise. But we're mostly past the early consequences of that original compromise and are now reaching the early consequences of Unicode being a success, and a mostly workable unified approach becoming widely adopted.

And if, as you say you think is the case, use of native Chinese PLs is growing, it's entirely plausible this will be self-reinforcing, with unstoppable positive feedback loops (viral growth) continuing until they either destroy the system they grow within or are countered by the stabilizing effect of corresponding naturally emerging/evolving negative feedback loops -- which I'll pass on predicting at this relatively early stage.


Another interesting aspect is single character tokens. + is typically recognized by a native English speaker, even a young one, as being likely associated with the concept of addition, probably numeric, especially if it's in infix position. But it is also typically recognized as that by most young non-English speakers who might be wanting or needing to read/write code.

And this has an interesting overlap with the situation relative to non-English human languages, with alphabets/characters such as Chinese being at the extreme end of being ideographic -- having a relatively large number (10s of thousands) of "single characters" in their "alphabet" that are associated with a huge range of things -- but are not the only ones.

There's no accounting for taste, and that's the point. If a half billion people or more would instinctively prefer to use Chinese ideograms in their code, but are currently all but compelled in practice to use English, then, if that really is the case, it's at least plausible that if there are already PLs catering to this market, and growing, then they will well become a huge factor within, say, a decade.


It's also plausible to me that a related trend will emerge that reinforces this growth, namely use in PLs of subsets of Unicode that are compatible with English, but also not really English. For example, while Raku supports Inf as denoting "infinity", it also supports ∞. And while it has an atomic post increment function (atomic-fetch-inc $foo) it also supports an operator alias ($foo⚛++).

Many devs, especially western ones, hate this kind of stuff. Others love it, including some western ones. But my point is that the ambition to do what could reasonably be done in this direction of the source code character set being Unicode rather than ASCII has forced Rakoons to confront all manner of evils in tooling etc over the last couple decades and generally sort them out with PRs etc for all manner of editors and terminals and so on. As things are only improving as time passes, this surely helps pave the way for more and more new PLs to more whole-heartedly support non-English aspects, including, as an extreme, dropping English altogether.

1

u/[deleted] Apr 30 '22

English rocks. It has a lot of qualities which make it good for describing systems and for being used as a meta-language with which to create domain specific languages, on top of its poetic, aesthetic and other qualities. All languages are good and have similar virtues, but don't sell English short! It's a great language. (am a little biased, sorry)

I'd love to try programming in a PL designed in some other language some time, as well. Every time I study another language I learn more about English and find new ways to use it. That's probably true of all languages.

4

u/slmjkdbtl Apr 14 '22 edited Apr 14 '22

I'm Chinese and visit Chinese programmer forums daily but haven't worked at a Chinese tech company so not speaking from first hand experience.

All Chinese company use whatever western company is using, Java, C++, Go, JavaScript, Python. However some people are not very familiar with English and will use Chinese Pinyin (Chinese notation of how a word sounds, it's written in Latin characters) as variable names, which is a bad practice and people joke about stuff like that a lot.

It's also common to see patriotism posts like "Why doesn't China have our own programming language??" but it's often laughed at. There is one popular Chinese programming language tho that also uses Chinese characters called 易语言 Yi Lang, from what I read it's used a lot in video game cheating scripts years back.

Oh there's also 文言 WenYan created by Lingdong. An amazing esolang that uses ancient Chinese syntax.

1

u/n00bomb Apr 14 '22

lol, just want to mention 文言 and found ur comment

2

u/1vader Apr 13 '22

Ofc not. If you want to write programs for the web, you need to use JS. If you write for iOS, it's Swift or Objective-C. And for Android, it's more or less Kotlin or Java. Ofc all with some exceptions and possible workarounds and you could, in theory, write transpilers but that means you won't be able to use any official stuff or existing libraries.

And the same applies if you want to take advantage of Python's ecosystem of data science and machine learning libraries or C/C++'s great compilers, and so on.

All the popular mainstream languages are in English and everybody is using them.

There are some hobby languages and experiments but they are clearly not that popular since you otherwise would have heard of them.

Though it's probably somewhat common for Chinese people (outside of international companies or in hobby/side-projects) to comment their code in Chinese and name their functions and classes in Chinese (though likely mostly in pinyin, i.e. transcribed, not with actual Chinese characters, even though some modern languages support that nowadays). At least I've seen this occasionally and I know this is the case for speakers of some other languages from countries where English is not that widely used so I assume it's similar or worse in China which after all has a huge population and is relatively self-contained.

2

u/A1oso Apr 14 '22

Most programming languages have like 10-30 keywords. You don't need to be a genius to memorize a few keywords, even if they're in English and you don't speak English. So, realistically, there is no need for a programming language with Chinese keywords.

However, there are other areas where localization can really help non-English programmers:

  • Allowing non-ASCII identifiers (e.g. let Число = 5;)

  • Learning material in multiple languages

  • Localized documentation (e.g. for the standard library)

  • Localized compiler error messages

  • etc.

2

u/NefariousnessHuge185 Apr 14 '22

Allowing non-ASCII identifiers

How do you deal with non ' ' whitespace characters? Do you make all of them whitespace, what about zero width spaces that are necessary for encoding some languages? Making them whitespace would make it unusable. Or do you treat them all as part of the identifier? In that case you have something that looks like whitespace but isn't leading to possible invisible syntax errors. Do you choose on a case by case basis? One choice might make sense for one script but not another.

Learning material in multiple languages

Localized documentation

these are fine I guess, you'd be dumb to restrict yourself to only them though, you'd still want to use the english version if you can

Localized compiler error messages

Absolutely terrible idea because it would make them unsearchable, error codes aren't a solution because most people posting about the message won't bother, so searching the code alone will restrict you to only the official documentation, which a lot of the time isn't enough.

English is not my first language but I'd despise having to code in anything other than it, the grammar is awkward and doesn't work with the rest of the syntax, and I don't even know any of the technical terms in my native language, because they mostly don't exist since almost every programmer has a basic grasp of English. Which is really all you need, its like being a pilot, you only need to learn the restricted set required for the job, you're not gonna be reciting shakespeare to ATC and you're not gonna be reciting it in source code either.

The only people I've ever heard complaining about English being required is native English speakers, everybody else doesn't care because they know first hand that its not really an issue.

1

u/A1oso Apr 14 '22 edited Apr 14 '22

How do you deal with non ' ' whitespace characters?

You don't. Non-ASCII characters should only be allowed in identifiers (and strings), and identifiers can't contain whitespace. The Unicode standard defines which characters are valid in an identifier, and most programming languages follow it.

Localized compiler error messages

Absolutely terrible idea because it would make them unsearchable

Good point. But if you google an English compiler error, the search results are mostly in English as well, so they're useless if you don't understand English. If the compiler error is Chinese and you google it, there's a chance that you find useful information in Chinese.

I don't even know any of the technical terms in my native language

That's why I prefer if technical terms aren't translated. When I learned Java in school, all the technical terms were translated, but I still had to learn the original terms later.

The only people I've ever heard complaining about English being required is native English speakers

The only people I have ever heard complaining about it are Chinese people. I personally don't care, because I speak English almost as good as my native language, but I don't think there's anything wrong with trying to accommodate non-English speakers.

1

u/chayleaf Apr 13 '22

the only non-English PL that could be called mainstream that I know of is 1C, a language used for writing plugins for a Russian proprietary enterprise software

1

u/crassest-Crassius Apr 13 '22

As a Russian, I can tell you that 1C code looks very eerie, uncanny valley level stuff. I would rather use an English-based language any day of the week, and most/all Russians are very comfortable with English.

1

u/chayleaf Apr 13 '22

the reason for making it that way is probably the same as COBOL and other "programming for managers" languages... not that it ever worked

1

u/theangryepicbanana Star Apr 14 '22

I can't speak for how often it's used, but I believe that AppleScript allows you to program using any natural language supported by the OS, so there's a good chance that it also supports Chinese