[Mono-devel-list] intergration with other languages

Jonathan Pryor jonpryor at vt.edu
Wed Jun 9 07:01:39 EDT 2004

On Tue, 2004-06-08 at 22:52, Marcus wrote:
> I should add that the design of the CLI restricts many languages to a subset 
> of their usual features.

This isn't *strictly* true, but generally true.

The more correct answer is that if you want cross-language integration,
you need to stick to a common subset, the Common Language Specification
(CLS).  You can go beyond this, but in doing so other languages might
not be able to use your code.

For example, Generics won't be part of the CLS, but a number of
languages will support it -- C#, Visual Basic .NET, and C++/CLI, to name
a few.  Not all languages will support generics, which is important to
keep in mind.

> For example, MS Managed Extensions for C++ permits code to be compiled to a 
> combination of managed and unmanaged code. The sections that are designed to 
> be compiled to managed code cannot use copy constructors, cannot use multiple 
> inheritance of implementation, etc.

This is where the distinction made above comes in. :-)

Full C++, complete with template support, multiple inheritance, copy
constructors, everything, can be compiled to IL.  This is the "It Just
Works" part of the Managed C++ compiler -- It Just Works.  The problem
is, yes, you can use the full language, but NO OTHER LANGUAGES CAN. 
Once you use parts outside of the CLS -- templates, copy constructors,
multiple-inheritance, etc. -- your language can still be represented in
IL, but other languages can no longer make *direct* use of that code. 
(For example, a multiple-inheritance C++ class could implement a CLS
interface, and thus could be used by C#, but *only* through that

A lot of the changes made to language for CLS compliance are so that
they can generate code usable by other languages, so that they can be
"CLS Extenders".  In the case of Managed C++, direct support for
properties is one such example.

 - Jon

More information about the Mono-devel-list mailing list