| Type extension through polymorphism |
| Full text |
Pdf
(299 KB)
|
| Source
|
ACM Transactions on Programming Languages and Systems (TOPLAS)
archive
Volume 12 , Issue 1 (January 1990)
table of contents
Pages: 135 - 138
Year of Publication: 1990
ISSN:0164-0925
|
|
Author
|
|
F. Warren Burton
|
Department of Computer Science, 3190 MEB, University of Utah, Salt Lake City, UT
|
|
| Publisher |
|
| Bibliometrics |
Downloads (6 Weeks): 3, Downloads (12 Months): 38, Citation Count: 4
|
|
|
ABSTRACT
A record data type can be extended by addition of more fields. The extended type is a subtype of the original, in that any value of the extended type can be regarded as a value of the original type by ignoring the additional fields. This results in a type hierarchy.
Milner [3] has proposed a polymorphic type system. With the Milner approach, the type of a function may contain type variables. This also results in a type hierarchy.
In a language with a polymorphic type system, if it is anticipated that a record type will need to be extended, then the record type can be defined to have a dummy extension field. In the parent type, the extension field will have null contents of type void. The type of the extension field can differ with different subtypes.
The approach can be extended to allow a type to be subtype of two or more parent types.
To a limited extent, this approach can be used in Ada and other languages with generic program units.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
 |
2
|
|
| |
3
|
MILNER, R. A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17 (Dec. 1978), 348-375.
|
| |
4
|
|
| |
5
|
|
 |
6
|
|
 |
7
|
|
|