Type dispatch for named hierarchical types

Authors
Citation
N. Glew, Type dispatch for named hierarchical types, ACM SIGPL N, 34(9), 1999, pp. 172-182
Citations number
18
Categorie Soggetti
Computer Science & Engineering
Journal title
ACM SIGPLAN NOTICES
ISSN journal
15232867 → ACNP
Volume
34
Issue
9
Year of publication
1999
Pages
172 - 182
Database
ISI
SICI code
1523-2867(199909)34:9<172:TDFNHT>2.0.ZU;2-3
Abstract
Type dispatch constructs are an important feature of many programming langu ages. Scheme has predicates for testing the runtime type of a value. Java h as a class cast expression and a try statement for switching on an exceptio n's dass. Crucial to these mechanisms, in typed languages, is type refineme nt: The static type system will use type dispatch to refine types in succes sful branches. Considerable previous work has addressed type case construct s for structural type systems without subtyping, but these do not extend to named type systems with subtyping, as is common in object oriented languag es. Previous work on type dispatch in named type systems with subtyping has not addressed its implementation formally. This paper describes a number of type dispatch constructs that share a comm on theme: class cast and class case constructs in object oriented languages , ML style exceptions, hierarchical extensible sums, and multimethods. I de scribe a unifying mechanism, tagging, that abstracts the operation of these constructs, and I formalise a small tagging language. After discussing how to implement the tagging language, I present a typed language without type dispatch primitives, and a give a,formal translation from the tagging lang uage.