tags:

views:

124

answers:

2

This page explains about the four different mono compilers - mcs/gmcs/smcs/dmcs.

To me, it's a little bit weird to have four C# compilers, as normally, the newer version of compilers maintain backward compatibility.

I assume that's because of the runtime support issues, but Microsoft's C# might have the same problem with only one cs.exe that support all of the runtime versions.

+6  A: 

For the same reason you can still do development in .NET 2.0 with Visual Studio 2005. Sure, you could use VS2010 and start a .NET 4.0 project with only .NET 2.0 code, but some companies are afraid of upgrading frameworks/compiler versions if they already have something working properly.

Just because the new compiler version is backwards compatible does not mean that teams will want to upgrade.

Having the different compiler versions ensures all of Mono's users can still use whatever compiler version they choose and are comfortable with.

  • mcs: compiler to target 1.1 runtime (to be deprecated with Mono 2.8).
  • gmcs: compiler to target the 2.0 runtime.
  • smcs: compiler to target the 2.1 runtime, to build Moonlight applications.
  • dmcs: Starting with Mono 2.6 this command is the C# 4.0 compiler, and references the 4.0 runtime.

Personally, I like upgrading whenever I can, but some companies and teams are unable to do so for some reason or another.

Robert Greiner
+3  A: 

It's because Mono's compiler is written in C# and uses System.Reflection, which means it can only access mscorlib from the runtime that it's running on. Therefore, for example, smcs doesn't just target 2.1, it actually uses 2.1 corlib, etc.

There have been plan for a while to have *mcs use either Mono.Cecil or Ikvm.Reflection instead of System.Reflection, which would mean there could then be a single mcs compiler with arguments to target different runtimes.

Microsoft's compiler doesn't have this limitation because it doesn't use .NET Reflection (it's written in native code).

mhutch