tags:

views:

78

answers:

4

What programming languages allow you to define names of variables, classes and functions using Unicode symbols?

+1  A: 

Java.

Grzegorz Oledzki
+2  A: 

There are many of them. The most popular being Java (see another answer here, http://stackoverflow.com/questions/1422655/java-unicode-variable-names). Python 3 also supports unicode letters in identifier names.

Tõnis M
+3  A: 

Certainly C#, and I believe java:

using משליט = System.Object;
using תוצאה = System.Int32;
public class שלום : משליט  {
    public תוצאה בית() {
        int אלף = 0;
        for (int λ = 0; λ < 20; λ++) אלף+=λ;
        return אלף;
    }
}
Marc Gravell
It is however not recommended to use smth. like this in an international project :)
psihodelia
Java definitely allows that (didn't want to edit your post, this doesn't really feel like a "fix" to me).
Joachim Sauer
Btw, I always found it good that Unicode support is finally so widely available, but never used it (usually all my code is english-language only, although German is my native language). But I never thought about the implications of LTR scripts in programming code. It definitely breaks the text flow when the language and its keywords is RTL and the identifiers are not (or even worse: they are mixed). The `int` variable definition above renders as `int 0 = <hebrew characters>;` for me, which looks ... very, very strange. But maybe that looks normal to someone who's used to that script.
Joachim Sauer
I fully agree - very strange looking, and definitely not code I'd want to debug. Now imagine the fun you could have with 17 (or however many) different variants of "i" ;-p
Marc Gravell
+1  A: 

Even C++ does ! The list is really to big to collect here.

Although I expect Unicode to be hell for languages that claim to be case-insensitive. After the statement Σ = 0, which of the following statements is true? ς == 0 or σ == 0 ? And assuming it would be the last, does that mean that the statement σ = 0 implies that ς == 0 ? (Σ is the Greek uppercase Sigma; ς and σ are its two lowercases).

MSalters
This is one of the reasons why case-insensitivity is often not a great idea from a coding perspective; if you treat every codepoint as distinct, you're fine. Beyond that, have fun trying to establish the equivalence mappings... :-)
Andrzej Doyle
Yup, you need a transistive symmetric reflexive relation between characters for that.
MSalters