Intensional polymorphism, the ability to dispatch to different routines bas
ed on types at run time, enables a variety of advanced implementation techn
iques for polymorphic languages, including tag-free garbage collection, unb
oxed function arguments, polymorphic marshalling, and flattened data struct
ures. To date, languages that support intensional polymorphism have require
d a type-passing (as opposed to type-erasure) interpretation where types ar
e constructed and passed to polymorphic functions at run time. Unfortunatel
y, type-passing suffers from a number of drawbacks: it requires duplication
of constructs at the term and type levels, it prevents abstraction, and it
severely complicates polymorphic closure conversion.
We present a type-theoretic framework that supports intensional polymorphis
m, but avoids many of the disadvantages of type passing. In our approach, r
un-time type information is represented by ordinary terms. This avoids the
duplication problem, allows us to recover abstraction, and avoids complicat
ions with closure conversion. In addition, our type system provides another
improvement in expressiveness; it allows unknown types to be refined in pl
ace thereby avoiding certain beta-expansions required by other frameworks.