Common Language Specification

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A Common Language Specification (CLS) is a document that says how computer programs can be turned into Common Intermediate Language (CIL) code. When several languages use the same bytecode, different parts of a program can be written in different languages. Microsoft uses a Common Language Specification for their .NET Framework. To fully interact with other objects regardless of the language they were used in, objects must expose to callers only those features that are common to all the languages they must exchange information with. It was always a dream of Microsoft to unite all different languages into one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines for languages to follow so that it can communicate with other .NET languages in a seamless manner.

Most of the members defined by types in the .NET Framework class library are able to work with CLS. However, some types in the class library have one or more members that are not able to work with CLS. These members allow support for language features that are not in the CLS.

The CLS was designed to be large enough to include the language constructs that are commonly needed by developers, yet small enough that most languages are able to support it. Any language construct that makes it impossible to quickly confirm the type safety of code was excluded from the CLS so that all languages that can work with CLS can produce verifiable code if they choose to do so.