"M" Types Overview ("M" Reference)
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
Within the Microsoft code name “M” modeling language, a type is a specification for a set of values. “M” is a structurallytyped language rather than a nominallytyped language, which means that two types are the same if the same collection of values conforms to both types regardless of the name of the types. For example, if you define two types, SomeNumber
and AnyNumber
, and both of those types are defined as "any integer", then those types are considered the same type by the “M” compiler, even though they have different names. This also means that a collection of the integers that is comprised of one through ten is simultaneously a collection of SomeNumber
types as well as a collection of AnyNumber
types.
It is not required that a type be named to be used. A type expression is allowed wherever a type reference is required. Types in “M” are expressions that return collections.
The types of the “M” language are divided into two main categories: intrinsic types and derived types. An intrinsic type is a type that is already defined in the “M” language and understood by the “M” compiler. A derived type is a type that you define within “M” code and can consist of a collection of intrinsic and other derived types.
All types except for the Any type (which is defined as "all possible values") are defined as a subset of possible values of another type. If every value that conforms to type A also conforms to type B, then A is a subtype of B (and B is a supertype of A). Subtyping is transitive, that is, if A is a subtype of B and B is a subtype of C, then A is a subtype of C (and C is a supertype of A).
Intrinsic Types
The “M” modeling language contains the intrinsic types shown in the following table.
Type  Description 

All possible values. 

All possible values except the Entity and Collection types. 

Any numeric value. 

A fixed point or exact number. 

A fixed point or exact number. 

A fixed point or exact number. 

A fixed point or exact number. 

A fixed point or exact number. 

A signed integer. 

A signed integer with fewer than 9 digits of precision. 

A signed integer with fewer than 17 digits of precision. 

A signed integer with fewer than 33 digits of precision. 

A signed integer with fewer than 65 digits of precision. 

A floatingpoint or exact number. 

A 32bit floatingpoint or exact number. 

A 64bit floatingpoint or exact number. 

An unsigned integer. 

An unsigned integer with fewer than 9 digits of precision. 

An unsigned integer with fewer than 17 digits of precision. 

An unsigned integer with fewer than 33 digits of precision. 

An unsigned integer with fewer than 65 digits of precision. 

A calendar date. 

A calendar date and time of day independent of time zone. 

A calendar date and time of day within a specific time zone. 

A time of day and time zone. 

A sequence of Characters. 

A logical flag. 

A sequence of binary octets. 

A single binary octet. 

An unordered group of potentially duplicate values. 

A collection of labeled values. 
Derived Types
Derived types are created by adding constraints to another type. Constraints limit the number of possible values that are contained within a type definition. The most common way of creating a new type is to add required fields that a type must contain. Consider the Address
type shown in the following code example.
type Address
{
Street: Text;
City : Text;
Region : Text;
PostalCode : Text;
Country : Text;
};
You can create your own derived type which includes the fields of the parent type as well as any additional fields specified. The following code is an example.
type WorkAddress : Address
{
OrgName : Text;
}