The Common Type System


Ultimately, all programs are built from data types. At the core of every language are built-in data types, ways of combining them to form new types, and ways of naming the new types so that they can be used like the built-in types.

Data types are more than just the contents of the bits that the data occupy. They are also the methods that can be used to manipulate them. In value-oriented programming, "type" usually means data representation. In object-oriented programming, it usually refers to behavior rather than to representation. The CTS combines these notions, so "type" means both of these things: two entities have the same type if and only if they have both compatible representations and compatible behaviors. Thus, in the CTS, if a type is derived from a base type, instances of the derived type may be substituted for instances of the base type because both the representation and the behavior should be compatible.

The idea of the Common Type System is that compatible types allow language interoperation. If you can read the contract provided by any type and use its operations, you can build data structures and use your control structures to manipulate them.

The CTS presents a set of rules for types. As long as you follow those rules, you can define as many of those types as you like in effect, the types are extensible, but the type system is not. For example, you can define any object or value type you like, as long as it follows the rules, but you cannot, for example, define a CTS-compliant type that uses multiple inheritance, which is outside of the type system.

The Common Type System was designed for broad reach: for object-oriented, procedural, and functional languages, generally in that order. It provides a rich set of types and operations. Although many languages have types that they have found useful that are not in the CTS, the advantages of language integration usually outweigh the disadvantages. Out of 20 languages that carefully investigated the CTS, at the time of this writing 15 have chosen to implement it.

The CTS is described in detail in section 8 of Partition I (Chapter 2 of this book).



The Common Language Infrastructure Annotated Standard (Microsoft. NET Development Series)
The Common Language Infrastructure Annotated Standard (Microsoft. NET Development Series)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 121

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net