Hacker News new | past | comments | ask | show | jobs | submit login
Chinese Python: “Translating a programming language” (reganmian.net)
26 points by sailormoon on Nov 30, 2009 | hide | past | web | favorite | 19 comments



I don't think translating the language itself makes that much of a difference. What most beginning hackers really need is the ability to search and read forum posts and code from a bunch of advanced hackers who already went through the problems they're having. Obviously English has the most depth in this regard. Chinese and Russian might be "deep enough" to get you to a decent level.

Beyond those three languages, I get the sense it drops off very quickly. I wouldn't want to be a monolingual Mongolian or Estonian trying to get Haskell help during a late night coding session, for example ...

some previous discussion on a similar topic here: http://news.ycombinator.com/item?id=894489


Chinese as a programming language has gained some market among Chinese programmers. There's government backed 汉编 which has little value, but there's also an cooperate-run programming language named 易语言, it's quite good. It can compile natively, object-originated, has all the features of VB, even support cross-platform UI (Win32 & GTK, IIRC).

http://www.dywt.com.cn/eftx/jdyx.htm (in Chinese)

An actual use case of 易语言 I can think of is the 360Safe, the No.1 anti-malware tool in China, part of its UI is written with 易语言


Interesting, I'm not familiar w/ Chinese programming jargon, but I can almost translate the feature line word for word:

> 完全面向对象,跨平台,支持Unicode、多线程,垃圾自动回收,类型反射,静态编译,动态类型装载等等

Completely object oriented, cross-platform, [with] Unicode support, multi-threading, garbage collection, reflection, static translation (?), and dynamic type something (装载/zhuangzai, but I'm not sure what it means in this context--ah! DLLs?).

The semantics & translation are much easier than what you would read in the newspaper.


I'm native Chinese. Here's my translation of the forementioned features:

"completely object-oriented, cross-platform, support Unicode, multithreading, GC, (type) reflection, statically compiled, dynamic type loading, etc"

I believe "dynamic type loading" must refer to something similar to DLLs here.

Though I'm not so sure about the whole idea of programming languages in various "human languages". It's the same doubt I have with internationalized domain names: not everyone can read/type it if they want.

It's fine if the the purpose is to teach primary school kids about programming (even though this isn't so good a reason: I know now in many primary schools in China, kids are taught English starting from grade 1), but for any serious programming it's better done in English, esp. in a world globalization and outsourcing dominate the software engineering field.

I'm a strong believer that every human being on the planet should speak at least one common language in order to have basic communication and understanding of other cultures. A few hundred years ago it was Latin; then French; now obviously it's English. And I'm quite happy to see the computer science field is standardizing on English.


> statically compiled

Ah, of course. I forgot what "compile" actually means!

I don't know, these words seem like a really thin gloss on their English equivalents.

A Japanese mathematician I know will mentally translate all the terms in a Japanese-language math paper to English. "It just sounds silly otherwise." I wouldn't be surprised if Chinese programmers do the same thing.


Modern Chinese nouns, esp. in technical fields, tend to be word-by-word translation of their original/English terms. It's crazy to invent a new set of terms for the same thing.

Unfortunately most Chinese translation of computer science/programming books are just garbage. The irony is that if you cannot understand a translated sentence in Chinese, try to revert it (usually word-by-word) back to English and then suddenly it rings the bell. That forces me to read the original one instead ...

I heard Japanese have better translation though ...


I’ve tried to learn Chinese, and I think I’ll take it up again. I’d rather the world standardized on a constructed auxlang than on a language that’s tied to a particular nation.


Unlike computer languages, constructed human languages seem never to gain enough mass to carry on. Too many people have invested too much time and money in English currently, so it's wiser to reuse that (or any other language provided it is popular enough).

Also I don't think English is tied to a particular nation ... well, maybe English-speaking nations. That's sad, but true, fact of life :|


I discovered a fascinating book once. It was written for English speakers, and explained certain Japanese words. There were, I believe, about thirty chapters, each covering ONE Japanese word: introducing the cultural background needed to truly understand the word; explaining all of its rich, subtle meanings... an attempt to teach the idea the word truly represented. The thesis is that many important single words simply have no direct, concise translation, to an English word or phrase.

Most mainstream programming languages today - from C, to Python, to Perl, to Java, to Javascript and Lisp [0] - were created by someone who was at least fluent in English - if not having that as their native language - and who "grew up" as an engineer by working with and studying other such languages. I wonder what kind of influence that has had on their design. Consider the if/then/else idiom that most programming languages have; or the while loop, or perhaps even the common OOP concept of classes (sets) and instance objects (members of a set).

Soon, if not already, there will start emerging higher-level, general-purpose programming languages that are conceived, designed, implemented and evolved by someone (or a group) that cannot read or write English, but has been fluent their whole life in Mandarin - someone who is a product of Chinese culture. Or Hindi, and India. Or Tagalog, and the Philippines. Some language and culture vastly different from that of the Germanic and Romance tongues, like English.

I wonder what those computer languages will be like. Obviously there must be similarities; it's still going to have to run on some hardware derived from von Neumann architecture, almost certainly. And it's difficult for me to imagine the subroutine / function call abstraction not being present in some form or another. But then, the only natural language I know well is English. Perhaps there are alternative forms I have not imagined yet.

The linked article describes an important start, I think. Even if it's technically just a different keyword / identifier mapping, perhaps it will start the gears turning in native Chinese speakers' minds.

[0] I consider Ruby a current "mainstream" language like Perl/Lisp/etc., since it was derived from the other languages mentioned - see this post by Matz: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/...

Edit: fixed a few typos.


Was the book you saw perhaps this: http://www.amazon.com/Dictionary-Basic-Japanese-Grammar/dp/4...

That book more than any other helped really solidify my japanese, precisely because it did what you say: it functioned as a foundation reference to the core of the language.

As for people with very basic modes of thought that are so different that their expression of logical statements would be different... Logic is logic. Its english grammar is a thin abstraction over its mathematical form, so I would be surprised if non-english-conceived programming languages would be dramatically different (aside from syntactic ordering perhaps).

Actually writing that sentence forced me to think of one such way a Japanese-inspired programming language might differ dramatically: since the subject of each verb is often left unstated in conversational japanese, you might have primitives that set the current 'variable context' and then all messages after that yet before the next 'variable context' change would go to that variable. something like:

foo(a, b, c){ talk_to(a) bar(b, c)

bar would implicitly actually be bar(a,b,c) (or a.bar(b,c) if you prefer).

This example seems pointless, but there might be other worthwhile ones.


What would be interesting is to take someone out of a non-technical and very 'foreign' culture, like the Maasai, and have them help derive a programmatic problem solving methodology.

For example, give them a set of known classical programming problems and see what methods they use to arrive at a solution.

I'm not sure this would bear much fruit, but it might still be interesting.


Arc should be ported to Chinese; it looks like you'd get much shorter programs out of the deal. And that's what language design is all about, right?


By utilizing the potential tersity of CJK characters in the language syntax, English-speaking programmers could make their programs much shorter wrt lines of code.

Because there's thousands of CJK characters to choose from, why not just use 印 instead of 印出 for 'print', or 如 instead of 如果 for 'if'? By using bracketing syntax instead of Python's indentation, we can cut down lines of code.

Here's your example using a terser style (the strings and comments would still be in English):

#!/usr/bin/env zhpy

# 檔名: while.py

數= 23, 運= 真

當(運){

  猜= 整(輸入'Enter an integer: ')

  如(猜 == 數){

    印'Congratulations, you guessed it.'

    運= 假 # this causes the while loop to stop

  }否如(猜<數) 印'No, it is higher than that.'

  否 印'No, it is lower than that.'
}否 印'The while loop is over'

印'Done'


I think that's a good argument against using character count as a measure of program length. i.e. translating 印 to print does not improve the program in any way, so it shouldn't score better in any measure of complexity.


'print' is 5 characters long, 印 is 1 character long. Though in most fonts, CJK characters are twice as wide as Latin, so better make that 2 chars long. 5 chars vs 2 chars over an entire program adds up. In non-indentation languages, that can mean 3 lines can be put onto 1 line. Shorter programs are more readable, have less errors.


Shorter by token count, not byte count.


Eat your heart out, Obfuscated Perl! :-)

This might be misplaced effort - the many chinese coders could be helping improve standard Python, libraries, i18n in various Chinese dialects, etc. - but this is still fascinating.


Sweet. That program is in traditional Chinese, BTW. It must be from TW or HK. People in China would be using simplified.

I've also seen Japanese programming languages before.





Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: