We propose a conservative extension of the polymorphic lambda calculus (F-o
mega) as an intermediate language for compiling languages with name-based c
lass and interface hierarchies. Our extension enriches standard F-omega wit
h recursive types, existential types, and row polymorphism, but only ordere
d records with no subtyping. Basing our language on F-omega makes it also a
suitable target for translation from other higher-order languages; this en
ables the safe interoperation between class-based and higher-order language
s and the reuse of common type-directed optimization techniques, compiler b
ack ends, and runtime support.
We present the formal semantics of our intermediate language and illustrate
its features by providing a formal translation from a subset of Java, incl
uding classes, interfaces, and private instance variables. The translation
preserves the name-based hierarchical relation between Java classes and int
erfaces, and allows access to private instance variables of parameters of t
he same class as the one defining the method. It also exposes the details o
f method invocation and instance variable access and allows many standard o
ptimizations to be performed on the object-oriented code.