We are in the middle of closing down the V2 of the CLS and I have been surprised by the number of folks that don’t know what the CLS is.   The CLS (or Common Language Specification) is a simply a contract between programming language designers and class library authors.  On the one hand the language designers such as C#, VB, C++, Cobol, Eiffel, FORTRAN, etc agree to extend their languages to support, through some means, the ability to access functionality exposed with features from the CLS.   On the other hand library designers (such as the .NET Framework, WinFX, 3rd party controls, etc) agree to expose all their functionality in such a way that it can be used with just those features from the CLS.  

 

The CLS is basically just a subset of the entire set of features supported by the CLR.  The CLS includes things such as calling virtual methods, overloading methods and does not include things such as unsigned types.  The first thing you will notice is that the CLS is weighted very heavily in favor of the library designers.  Nearly every meaningful feature of the CLR is exposed in the CLS.    We initially started with the idea that we’d just use the subset of all programming languages but quickly discovered that would leave only calling static methods (if that).  So we opted, wisely, to include nearly everything a library designer might need.  This is actually a big win for language vendors because at least they have a clearly spelled out list of things they need to support.  It is not something you find out by testing 1,000s of libraries in the wild.  

 

Why should you care?  Well, if you are just building end applications or libraries that will only be used by a single language don’t worry about the CLS.  Use all the features your language of choice offers you.  If you are building a library that you hope to be used by a wide range of developers you might find it useful to conform to the CLS such that you have an open ended market.  After all, who knows when that next big language will catch on and be as big as VB, C# or C++?  Ruby, Python, etc all have a chance.  If you conform to the CLS your library will be useable by that language.  Lastly, if you are a language designer, it is clearly in your interest to take advantage of the rich set of functionality exposed in the .NET Framework, WinFX and 3rd party libraries.  To do so, all you need to do is support all the CLS constructs.

 

 

Some links:

The CLS and the Design Guidelines

Jim Miller’s The Common Language Infrastructure Annotated Standard has some good info as well. 

The Partition I of the ECMA\ISO standard has the full set of rules.

See the docs for more information.