views:

102

answers:

4

As the title says, I am just a little curious...I have seen some European open-source projects post the source, but it was all syntactically identical. What about Chinese or Japanese or other more complex character-based languages?

UPDATE: This was a little misleading I guess. I was asking about the "traditional" .Net languages like C#, VB.net, maybe even F# etc. I understand now that there are newer .Net languages that are being create primarily to support non-English written and spoken languages and that they appear very dissimilar to similar source written in VB.net and C#.

I will try to up vote a few people and mark the answer to my intended question as the answer.

A: 

Everybody writes code in english

gandjustas
Well, [no](http://en.wikipedia.org/wiki/Non-English-based_programming_languages#Based_on_non-English_languages).
Michael Petrotta
+3  A: 

Syntactically identical. A programming language should be syntactically universal.

Justin Niessner
That being said - he didn't specify any specific language. I just added a couple of examples of very different looking languages targetting .NET to my answer ;)
Reed Copsey
@Reed Copsey - But each of those is a new language in its own right with its own syntax (which, obviously, is far different looking) correct?
Justin Niessner
@Justin: But those are still used for ".net source"... If you write code in C# or VB.NET, it'll use the same syntax, of course :)
Reed Copsey
@Reed Copsey - Doh! I just re-read the question and saw the part I missed. For some reason I thought I saw C# in there. But in that case, wouldn't ".NET Source" be considered IL (and, in that case, be the same across spoken language)?
Justin Niessner
Good point. Though IL, in its binary form, looks like gibberish in every language ;)
Reed Copsey
@Reed Copsey - But at least that gibberish is consistent no matter what language you speak. Haha.
Justin Niessner
+4  A: 

This, of course, depends on the language.

The individual language syntax and rules will not change. For example, C# will still use the same characters and keywords, no matter what language is being developed. However, variable names and the like are allowed to use (nearly) any unicode characters, which means people in other languages can use non-English naming.

That being said, there is nothing preventing people from making a new .NET language with identifiers that are not English in nature - Examples include Lexico, the Hindi Programming Language, and Farsi.NET.

Here's some sample code from the Lexico site:

incluya "System.Windows.Forms" 
clase ventana derivada_de "System.Windows.Forms.Form" { publicos: mensajes: ventana copie "Este es el título de mi primera ventana" en ventana.text }
Reed Copsey
+3  A: 

The keywords are in english, so most of the code is the same in any language. Some people use local languages for identifier names, others keep the names in english too.

Here's an example of how some code would look like with swedish identifiers:

public class StenSaxPåse {

  public enum Värde { Papper = 0, Sten = 1, Sax = 2 }

  private Värde _värde;

  public StenSaxPåse(Random slump) {
    _värde = (Värde)slump.Next(3);
  }

  public bool SammaSom(StenSaxPåse andra) {
    return _värde == andra._värde;
  }

  public bool Slår(StenSaxPåse andra) {
    return
      (_värde == Värde.Papper && andra._värde == Värde.Sten) ||
      (_värde == Värde.Sten && andra._värde == Värde.Sax) ||
      (_värde == Värde.Sax && andra._värde == Värde.Papper);
  }

  public override string ToString() {
    switch (_värde) {
      case Värde.Papper: return "PAPPER";
      case Värde.Sten: return "STEN";
      default: return "SAX";
    }
  }

}
Guffa
Interesting to watch the syntax colorizer get all confused by the diacritics.
Michael Petrotta
Agreed Michael. Also Guffa, I assume you typically write your source comments in your native language as well?
fdfrye
@fdfrye: I usually use only english identifiers and comments, but there are a few comments in swedish here and there.
Guffa
@Michael Petrotta: Yes, I noticed that too. The .NET languages is a bit unusual in the way that they actually allow diacritics in identifiers. Many languages don't, which makes it harder to use local languages for identifiers.
Guffa
@Guffa: Tänk på att nationalitetsord alltid inleds med versal på engelska. T.ex. heter det "Swedish", inte "swedish".
Andreas Rejbrand