A Virtual Class Calculus
Virtual classes are class-valued attributes of objects.<br />Like virtual methods, virtual classes are defined in<br />an object’s class and may be redefined within subclasses.<br />They resemble inner classes, which are also<br />defined within a class, but virtual classes are accessed<br />through object instances, not as static components<br />of a class. When used as types, virtual classes depend<br />upon object identity – each object instance introduces<br />a new family of virtual class types. Virtual classes support large-scale program composition techniques,<br />including higher-order hierarchies and family<br />polymorphism. The original definition of virtual<br />classes in Beta left open the question of static type<br />safety, since some type errors were not caught until<br />runtime. Later the languages Caesar and gbeta have<br />used a more strict static analysis in order to ensure<br />static type safety. However, the existence of a sound,<br />statically typed model for virtual classes has been a<br />long-standing open question. This technical report<br />presents a virtual class calculus, vc, that captures<br />the essence of virtual classes in these full-fledged programming languages. The key contributions of the<br />paper are a formalization of the dynamic and static<br />semantics of vc and a proof of the soundness of vc.<br />Categories: D.3.3 [Language Constructs and Features]:<br />Classes and objects, inheritance, polymorphism.<br />F.3.3 [Studies of Program Constructs]:<br />Object-oriented constructs, type structure. F.3.2<br />[Semantics of Programming Languages]: Operational<br />semantics.