XCSG:TypeAlias

From AtlasWiki
Revision as of 16:49, 5 March 2014 by Xingyan (Talk | contribs) (Created page with "An AliasType introduces a synonym for an existing type analogous to the use of typedef in C++. The semantics of AliasType are those common to the UML Meta-Object Facility (MO...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An AliasType introduces a synonym for an existing type analogous to the use of typedef in C++.

The semantics of AliasType are those common to the UML Meta-Object Facility (MOF) definition of AliasType and the C++ definition of typedef.

An AliasType does not introduce a new type, but provides a synonym (alias) for a given type, the referenced type. This type may be an existing type. or an instantiation of a type with template parameters.

An AliasType may appear anywhere the referenced type may appear.

The semantics of the model are unchanged if all occurences of an AliasType are replaced by occurences of the referenced type.

An AliasType is similar to a subtype of a UML Class or Datatype. AliaasTypes differ from subtypes, however, in that a) they cannot extend their parent classifier definition, and b) if more than one alias is created for a type, they are treated as the same type with regard to assignment and type compatibility.

In this regard, the use of subtypes is generally preferable since subtypes can be extended to include new attributes and operations, and since they are strongly typed (are not treated as the same type, but as distinct types, with explicit conversions between them).

Specifications

Metaclass AliasType
Extends Classifier
Description An alias for an existing type
References AliasType [6, p. 3-15, table entry], [6, p. 3-32, Figure 3-4, MOF Data Type Elements], [6, p. 3-36], typedef [44], [46]


Language mappings

AliasType maps to typedef in C++.