[Mono-devel-list] ECMA verrsions of C#

Jonathan Pryor jonpryor at vt.edu
Wed Jun 30 19:53:50 EDT 2004

On Sat, 2004-06-26 at 09:04, Matthias Kempka wrote:
> Roadmap, that is where I didn't look, but there it is:
> # mono: will contain the above features implementing the .NET 1.1 API.
> # mono-1.0-compat: Will include a build of the libraries with the .NET 
> 1.0 API, this is a compatibility build for people running .NET 1.0 
> applications.

Note two things: (1) it mentions "compatible with the .NET 1.0 API, and
(2) it doesn't mention the language it all.  Strictly speaking, it
doesn't need to mention the language level, as all C# 1.0/1.1 code will
continue to compile and run properly under C# 2.0.

The key point to keep in mind is that .NET keeps the languages and the
class libraries completely separate.  Except for language features which
require runtime/class library changes (read: generics), you can use any
language version on any version of .NET.  Code using C# 2.0 features
such as anonymous delegates, iterators, and partial classes will execute
on .NET 1.0 and 1.1, so it's important to remember this.

> Perfectly. Now I know what I was looking for.
> And what I'm asking for is that somewhere in the version or about 
> information of a specific release is the information which features of 
> the .NET API are implemented. And I can explain why:

See above comment about separation of language and runtime.

> .NET is not in the business world yet. It is at the universities (fundet 
> by Microsoft) where teachers teach it by giving C# courses. And the 
> students will be (so Microsoft hopes) the ones who in 10 years or so 
> make the decisions in the industrie pro .NET.
> As many people students are not really happy with MS, and they see that 
> for .NET there is mono, and they give it a try. Now guess, the course is 
> MS-specific, and they learn just C#, and the version talk in the course 
> goes so far that C# 2 will contain generics but isn't released yet, so 
> in the head of people there is just C# version 1.
> I guess I am not the only one who doesn't look up every feature in the 
> documentation but first tries if the compiler takes it the way I think.
> Now they find a thing that does compile on mcs but as they hand the 
> program in it doesn't compile at the teachers compiler. Doubt, 
> uncertainty, and the information of the binaries (the thing they have at 
> hand) doesn't give anything beside the mono/mcs version. The resulting 
> thought is, if I have to be sure I must take the MS compiler.

Even if the version information were written in a conspicuous location
(which it has been, in the release notes), I'd bet that most people
still wouldn't see it.

Also, this isn't any different than previous experiences in an academic
environment.  Consider C++: for *years* GCC had better template support
than Microsoft Visual C++, even though they've been part of the C++
standard for an even longer period of time.  So what do you do?  Mandate
a compiler and say "it *must* compile in this environment."  (An
alternate approach I saw at the same university was "it must compile and
run, but you have to prove it."  If this mean bringing a laptop in to
compile and demonstrate the code, so be it.  And from experience, it's
good to keep this in mind when compiling under linux and running under
FreeBSD; I hit some incompatibilities...)

The university should state, up front, which compiler to use and which
runtime version to use.  Students can *use* whatever they want, but the
responsibility is on them to make sure their code works properly in the
required environment.  It's been this way for years, and I don't see
this changing with .NET or Java in any way.  (Yes, Java.  I can imagine
compiler bugs showing differences between javac and jikes, for example,
plus you have to specify which language version is permitted, and the
class libraries...)

> Still now after this thread and reading the road map, I am still 
> uncertain what part of the specifications my mcs comiles and how I can 
> ensure whether my working code will compile on my teachers compiler. 

If you want 100% security, use your teachers computer.  For 99%
security, use the same environment.  Anything else is up in the air. 
Remember, there are two versions of .NET -- 1.0 and 1.1 -- and there
isn't 100% compatibility between them.  Introducing Mono changes things
only slightly.

> Dennis told me, 2.0 features are turned on by default, the roadmap says 
> mono 1.0 will contain only 1.1 features,

The roadmap says Mono 1.0 will contain the 1.1 *API*, and is silent
about the compiler.

>  and the mcs faq tells me I have 
> to turn on 2.0 features (such as method conversion) by the -v2 switch. 
> So, as you may see, something is inconsistent, and just by putting the 
> information which specification a release tries to match into it can be 
> a valuable clue.

This is part of the Mono 1.0 release notes:

        The compiler implements the ECMA C# 1.0 implementation with
        support for CLS compliance compilation. In addition it has
        support for implicit method group conversions and iterators.
        These features are turned on by default.

Strictly speaking, it should say ECMA C# 1.1, but it mentions *by name*
C# 2.0 features (method group conversions and iterators).  Whether
anyone will read this is another matter...

 - Jon

More information about the Mono-devel-list mailing list