[Mono-list] C++ compatible CLR?

Fergus Henderson fjh@cs.mu.oz.au
Mon, 16 Dec 2002 22:15:14 +1100


On 16-Dec-2002, Freddy BL <freddy_bl@hotmail.com> wrote:
> Yesterday I have read an ca 1 years old article about .net again.
> 
> In this magazine there stood advantages and disadvantages of C# and .net 
> (and things, what could be better) .
> 
> Some of the things, which the magazine have listed, what could be better 
> is, that the CIL is not compatible to C++.
> Not all C++-programs can be compiled to the CIL.

This is not true.  C++ programs can, at least in theory,
all be compiled to the CIL.

Now, whether or not there is an existing C++ compiler which is capable of
it, that is another question.  I don't know if Microsoft's C++ compiler
supports it, and currently Microsoft's C++ compiler is AFAIK the only
one which can compile to CIL.  If MSVC++ supports multiple inheritence
when compiling to CIL, the article that you read is now out-of-date.
(I don't happen to have a Windows machine handy to check it.  Maybe
someone else on this list can do so.)

> The reason is, that C++ 
> supports "Mehrfachvererbung" for example - the CIL dosen't.
> ("Mehrfachvererbung" is a german word. And I don't know how it is called in 
> english. Is it called "multi-heredity" ?)

The English for that would be "multiple inheritance".

> So, is it possible, that Mono integrate this features in its CIL, which 
> Microsoft haven't integrated?

It might be possible, but it's certainly not clear that doing so would
be a good idea.  Different languages that support multiple inheritence
tend to do so with different semantics, so there's no one single
agreed-on definition of multiple inheritence which would be directly
suitable for all languages.  Also, multiple inheritence significantly
increases the complexity of the system.  It's probably better to
convert code using multiple inheritence in the language front-end
(i.e. the C++ to CIL compiler), rather than in the CIL implementation.

> The other disadvantages, which are they have published are all refered to 
> C#. But, because C# is only _one_ language for the CIL, I don't see it as 
> so important as to have a CIL which can be used for all 
> programming-languages.

Another potential disadvantage is performance, especially for non-C#-like
languages.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.