Topic: restricted and extended types

topics > computer science > programming > object-oriented programming > Group: type inheritance

derived data types

data type as a set of values
dynamic type checking
extensible languages
knowledge representation by frames
object-oriented prototypes
opaque and partially-opaque data types
range data type
referential transparency
type conversion
type hierarchy
type inheritance as reuse
user-defined data type
variant data types


A restricted version of type inheritance is data type extension and restriction. A type can be defined directly in terms of another type, by extending its definition or by selecting a sub-set of its definition. Components can be renamed, initialization routines expanded, and new parameters appended. Need a type guard and dynamic type checking to distinguish the possible types. (cbb 5/80)

Some operations require a restriction of a value set. For example division is invalid on 0. (cbb 1/90)

Subtopic: behavior vs. representation up

Quote: separate inheritance of behavior (behaves-like) from inheritance of representation (subsumes)

Subtopic: extended type up

Quote: an Ada derived type defines a new type which inherits all operations and attributes of its base type [»maclBJ_1987]
Quote: an extended record type in Oberon adds fields to an existing type; retains compatibility with old types [»wirtN7_1988]
Quote: implement extended types in Oberon with extended declaration, type test, and type guard; allows inheritance of data fields and operations [»wirtN4_1988]
Quote: classes are a remodeling of records; hierarchical tree structure; members are objects; the prefix of a subclass is the higher level class [»dahlOJ_1967]
Quote: inheritance is record combination; the record for a new class is like its parent's record, but extended with new properties [»taivA9_1996]
Quote: an object type determines a prefix of the data record and method suite; subtypes may define additional fields and methods
Quote: can extend imported Oberon data types without losing compatibility with the base type; motivation for the Oberon language [»wirtN9_1989]
Quote: can define an Alphard form as an extension of another one [»shawM8_1976]
Quote: assigning an extended type to a base type copies the shared fields only [»wirtN7_1988]
Quote: data structures of different extended types that use the same base type [»wirtN7_1988]
Quote: use display mechanism for run-time access to extended type descriptors; construct at compile time [»coheNH10_1991]
Quote: a Piccola form is an immutable, extensible record [»acheF9_2000]

Subtopic: extension method up

Quote: an extension method take 'this' as the first parameter; extends existing types such as IEnumerable [»bierGM10_2007]

Subtopic: restricted values up

Quote: while some operators apply to many types, others apply to restricted types, e.g., division [»hehnEC7_1975]
Quote: a subrange is called a subtype in Ada; it inherits operations and remains compatible [»maclBJ_1987]
Quote: a restricted type matches the base type's structure and may be used everywhere the base type is used [»simeJ1_2003]
Quote: some values of composite types are invalid; need run-time checks, e.g., array bounds [»kiebRB9_1973, OK]
Quote: can restrict a value or object by excluding some of its public attributes [»maclBJ12_1983]
Quote: a type is a subtype if it uses a subset of values and a superset of operations [»boutRT1_1990]
Quote: entities of a subtype of an entity type are necessarily entities of the parent type

Subtopic: domain type up

Quote: a domain distinguishes values of the same basic data type with a range and optional ordering [»coddEF_1990]
Quote: define a domain as a syntactic pattern, e.g., names are first_name, last_name [»mcleDJ3_1976, OK]
Quote: a data type is a character string that names a domain of values; domains and values are abstract [»harmDE5_1991]
Quote: a domain or scalar data type is a named set of scalar values; name equivalence [»dateCJ_1998]
Quote: in modern type theory, types are values in a suitable semantic domain; type constructors are maps from this domain into itself [»nelsG_1991]
Quote: a domain is the set of things that can occur in a given role of a relationship [»kentW_1978]
Quote: domains are the glue that holds a relational database together; shared descriptions; domain integrity, operators, and features
Quote: a natural join is the result of combining two relations using a shared domain [»coddEF6_1970]
Quote: a data type may partition a domain (disjoint) or use a predicate (overlapping sets) [»cartR1_1985]
QuoteRef: mcleDJ3_1976 ;;47 domains subset of reals or strings. normalized relations of tuples where each element is in corresponding domain eg name, age, occupation

Subtopic: properties up

Quote: use properties to distinguish types that have the same operations; e.g., the property 'LIFO' for type 'stack'; simulate with dummy functions [»rodrNR8_1993]

Subtopic: custom types up

Quote: variant-type -- a type could be all data structures that contain name and birth-date fields [»parnDL3_1976]

Subtopic: operation extension/restriction up

Quote: can modify a type by adding, renaming, or deleting operations [»demeA3_1979]

Subtopic: override up

Quote: a field or method in a subtype masks any field or method with the same name in the supertype; use NARROW to access the supertype [»cardL_1991]

Related Topics up

Group: derived data types   (9 topics, 119 quotes)

Topic: data type as a set of values (20 items)
Topic: dynamic type checking (43 items)
Topic: extensible languages (71 items)
Topic: knowledge representation by frames (18 items)
Topic: object-oriented prototypes (39 items)
Topic: opaque and partially-opaque data types (14 items)
Topic: range data type (17 items)
Topic: referential transparency (26 items)
Topic: type conversion (33 items)
Topic: type hierarchy (18 items)
Topic: type inheritance as reuse (27 items)
Topic: user-defined data type (13 items)
Topic: variant data types
(7 items)

Updated barberCB 3/06
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.