views:

172

answers:

11

This is a curiosity more than anything: Does there exist a programming language that allows variables, functions, and classes to be named using using Unicode rather than ASCII (except, of course, for special characters such as '+')? Do any popular languages have support for this?

Also, related to this, if any common language supports Unicode, then is there any way to convert an existing API into a language of the user's own choice? It seems like it would be helpful to give a programmer the ability to learn an API in their own language. I imagine downloading a standard API (for instance boost) and then downloading the standard translation mapping and then being able to program in my native language.

+4  A: 

C# allows this.

From MSDN:

The rules for identifiers given in this section correspond exactly to those recommended by the Unicode Standard Annex 15

Update:

As you can see from other answers, most modern languages allow this (Ruby, Java, variants of lisp, Fortess, ADA and more).


As for converting an API to a chosen language - this is not feasible. You would require a translator that understands the nuances and meaning of every method, variable and class name and translate those correctly - this is not the same as being able to use the characters of a chosen language in code.

Oded
I believe that ruby too.
Ikaso
Can the downvote please explain?
Oded
As far as the converting API to another language. I don't mean to imply automatic machine translation. Rather, if I was Chinese, I would like to use Boost in conjunction with some standardly accepted *API-skin* that converts the Boost API into Chinese. This way it would be much easier to learn. Granted, it would be a little more difficult to talk about with an English speaker, but I think that the API-skin would allow for translation the other direction as well. Besides, when the average Chinese programmer is talking about programing, he's likely speaking with another Chinese person.
John Berryman
+2  A: 

Ada (among others) allows for internationalized identifiers using UNICODE.

However, my personal opinion is software should be written using a single, universally understandable and sufficiently simple language (English, obviously) to encourage collaboration, ensure understandability and reusability of code.

Ondrej Tucny
Single, universally understandable and sufficiently simple... English scores 0.5 out of 3 there. (0 for single, 0.5 for sufficiently simple)
kotlinski
@kotlinski: English is the closes to universally understandable (among the most widespread languages, and certainly the most widespread one among tech people - http://meta.stackoverflow.com/questions/13676/is-english-required-on-stack-overflow has some nice data). And while English *is* complex, *all* natural languages are inherently complex - and English isn't the worst (German grammar, for example, is much larger and has more nasty corner cases).
delnan
@kotlinski This is, sure, subjective. In my opinion, when thinking about languages I know or I learned in the past, the complexity and easyness is like this: English < Netherlands < German < Russian < Czech. Czech is my mother tongue and I respect foreigners that can crunch it. On the other hand, English seems as the simplest. Once I saw an Ada source code written in Chinese… I didn't have a clue what was going on! :-)
Ondrej Tucny
@Downvoter Any comments?
Ondrej Tucny
@Ondrej see comment on Oded's answer. I wonder what your thoughts are.
John Berryman
+1  A: 

Java has this feature.

kotlinski
+1  A: 

Fortress makes extensive use of Unicode (perhaps in an APL-like way); see http://projectfortress.sun.com/Projects/Community/wiki/FeatherweightJava for one example.

Dan
+1  A: 

Some implementations of common lisp would allow this. AFAIK the language specification doesn't forbid it or require it (it only requires a basic ASCII character set).

John
+1  A: 

Delphi has that feature since Version 2009

Bernd Ott
+1  A: 

Javascript has this feature.

some
+1  A: 

Tcl allows you to use Unicode characters for command and variable names, though it's recommended to avoid them for variable names because the shortcut syntax doesn't cope at the moment (i.e., you'd have to use the form [set Ω] instead of ).

Donal Fellows
+1  A: 

.Net supports Unicode and I'm working with C# Unicode variable everyday.

Nasser Hadjloo
+1  A: 

C#, Java, Python3, as far as I know, are all Unicode based programming.

I found no one above mentioned Python, so I added it. Python has a fantasy feature: everything (function, class, module, variable, class instance) is object and every object can attached a document to describe it. This feature may be useful for organizing code and executing script interactively. For example:

# Python code in interactive mode
>>> def MyFunc():
    '''This is self-included document.
It can be write in multi lines.'''
    print('foobar')
>>> print(MyFunc.__doc__)
This is self-included document.
It can be write in multi lines.
>>> MyFunc()
foobar
Feil
+1  A: 

Scheme, PLT Racket and Lisp Flavored Erlang all allow for unicode identifiers (made simple thanks to prefix syntax)

I GIVE TERRIBLE ADVICE