Author Topic: What Is A #Sharp Language?  (Read 935 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7145
  • Karma: 69
    • View Profile
What Is A #Sharp Language?
« on: December 31, 2009 »


I know the names of two sharp languages C# and J#, there's bound to be more. but, what I wanted to know is, the reason that they are called sharp, and not part of C?

Cheers for enlightening me,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline JL235

  • C= 64
  • **
  • Posts: 71
  • Karma: 9
    • View Profile
    • Play My Code
Re: What Is A #Sharp Language?
« Reply #1 on: December 31, 2009 »
To answer this you need to understand that C#s main rival is Java. .NETs main rival is the Java platform. C# and Java are both aimed at similar domains. However C# and .NET are also quite different to Java (especially in recent years).

First C# is not C or C++. It runs at a higher level in a 'managed world', rather then the C/C++ 'native world'. But it when compared to C++ and Java, it comes right in the middle. That's why it has C in it's name, because it's more C++ influenced.

J# is a transitional langauge from Java to .NET (or more so, C#). It's essentially Java implemented to run on the .NET platform. That's why it's J#; J from Java and # from C#. But it's just the language syntax which is the same. For example it's libraries and native interface are different. But you can compile Java code with the Java compiler and run it on .NET via J#. This is very useful language if your moving a project from Java to .NET, hence transitional language. If your not porting a project, then I'd avoid it and use Java or C# instead.
Play My Code - build games in your browser!

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7145
  • Karma: 69
    • View Profile
Re: What Is A #Sharp Language?
« Reply #2 on: January 01, 2010 »
Thanks for the great answer dude :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16789
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: What Is A #Sharp Language?
« Reply #3 on: January 03, 2010 »
K+
Shockwave ^ Codigos
Challenge Trophies Won:

Offline JL235

  • C= 64
  • **
  • Posts: 71
  • Karma: 9
    • View Profile
    • Play My Code
Re: What Is A #Sharp Language?
« Reply #4 on: January 03, 2010 »
Another sharp is F#, currently the only other language after C# with XNA support. It's built to provide a functional language for .NET, and it's based on ML (similar to OCaml). Functional languages take a mathematical approach to tackling problems. For example they provide no loops (instead recursion) and all variables are final.

I'd recommend taking a look at F# solely because it's a chance to learn a functional language. They make you think and tackle problems differently; something you can use and apply in a non-functional language. Typically you also write FAR less code.

J++ should also get a mention. This is the Microsoft implementation of Java. Unlike J# (remember it's a java-like language for .NET, not Java) this is whole implementation including it's libraries and a Win32 specific implementation of the Java runtime. They licensed it from Sun Microsystems who later sued them over it. For that reason this language should be avoided at all costs because it is only supported for a limited amount of time; and that's solely for security and bug fixes.
Play My Code - build games in your browser!

Offline rdc

  • Pentium
  • *****
  • Posts: 1480
  • Karma: 138
    • View Profile
    • Clark Productions
Re: What Is A #Sharp Language?
« Reply #5 on: January 04, 2010 »
Just to add a bit more info on this. The .Net langauges are based on the CLI (Common Language Infrastructure (or Interface)) that MS developed as the back-end for Windows. All of the .Net languages are actually frontends to the CLI so there isn't a whole lot of difference between the different languages. If you look at C# and VB.Net you will see quite similar syntax.

In fact anyone can write a language that interfaces to the CLI;  Boo is a Python-like language that uses the CLI and isn't written by MS.

Offline JL235

  • C= 64
  • **
  • Posts: 71
  • Karma: 9
    • View Profile
    • Play My Code
Re: What Is A #Sharp Language?
« Reply #6 on: January 05, 2010 »
Just to add a bit more info on this. The .Net langauges are based on the CLI (Common Language Infrastructure (or Interface)) that MS developed as the back-end for Windows.
That's not true, the CLI describes the runtime (the Common Language Runtime) and the bytecode that it runs (Common Intermediate Language). This is the core of .NET. .NET is not at the core of Windows, it runs on top.

The CLR is an interpreter which only runs one language, CIL. However it will also compile the CIL to native code as it is executed, giving you the best of an interpreter and a compiler. This is known as just in time compilation. Java does exactly the same. It's runtime is the Java Virtual Machine and it's language is Java Bytecode. Although I believe you can also compile ahead of time straight to native code with .NET, you can't with Java.

All of the .Net languages are actually frontends to the CLI so there isn't a whole lot of difference between the different languages. If you look at C# and VB.Net you will see quite similar syntax.
Partly not true. Yes C#, VB.NET, IronRuby, IronPython, F# and all the others all target the same language. The bit that's not true is that this means all those languages are the same, they aren't. C# and VB.NET might have similarities but F#, C# and Forth are all quite different. There is nothing to stop you writing your own language for .NET, or porting some exotic languages to it.

The reason they all target CIL rather then x86 is because this allows them to all share the same optimizing compiler for the platform. i.e. It avoids each language needing to build their own x86 compiler. This is more useful for Java because it supports more processors. So any language that compiles to Java bytecode can run on SPARC, PowerPC, x86, ARM, Itanium and more.

Another reason is because CIL is essentially a simple assembly language. This means it is quick and simple for the runtime to parse and convert to native code.

Many native compilers also do the same, like GCC (the Gnu Compiler Collection). It's a collection of front-end compilers that all compile to the same intermediate language. These are then parsed compiled to native code for the platform it's compiling for. Some languages also use another language as their intermediate language. For example the Glasgow Haskell Compiler compiles to C--, an alternate form of C.
Play My Code - build games in your browser!

Offline rdc

  • Pentium
  • *****
  • Posts: 1480
  • Karma: 138
    • View Profile
    • Clark Productions
Re: What Is A #Sharp Language?
« Reply #7 on: January 05, 2010 »
You are splitting hairs here. The languages are different yes, but all of the .Net languages target the CLI so they all have the same backend. The differences are syntactic sugar.

Offline JL235

  • C= 64
  • **
  • Posts: 71
  • Karma: 9
    • View Profile
    • Play My Code
Re: What Is A #Sharp Language?
« Reply #8 on: January 06, 2010 »
You are splitting hairs here. The languages are different yes, but all of the .Net languages target the CLI so they all have the same backend. The differences are syntactic sugar.
For some languges, yes the difference is only syntax. But most contain features only available for one or two languages. Or emphasise a different approach and mindset to solving problems.

Pattern matching on parameters, recursion over iteration, inbuilt features for object-orientation, alternate threading models and compile time checking of variable contracts are not simply syntactic sugar.
Play My Code - build games in your browser!

Offline rdc

  • Pentium
  • *****
  • Posts: 1480
  • Karma: 138
    • View Profile
    • Clark Productions
Re: What Is A #Sharp Language?
« Reply #9 on: January 06, 2010 »
Heh. I disagree, but I'll let you have the last word on this. This is an interesting discussion and ultimately is more about programming philosophy (both in the language development, what to expose and what not to expose, and usage of the language, what a programmer feels is a "good" language) than in technical considerations.

I know when VB.Net came out many programmers moved to C# rather than continue with VB.Net. Many felt it would be easier to move to a different language and wouldn't get tangled up with old VB 6 habits in trying to use VB.Net.