R. Wilhelm (Ed.): CC 2001, LNCS 2027, pp. 1–2, 2001. © Springer-Verlag Berlin Heidelberg 2001 Virtual Classes and Their Implementation Ole Lehrmann Madsen Computer Science Department, Aarhus University, Åbogade 34, DK-8200 Århus N, Denmark Ole.L.Madsen@daimi.au.dk Abstract. One of the characteristics of BETA [4] is the unification of abstraction mechanisms such as class, procedure, process type, generic class, interface, etc. into one abstraction mechanism: the pattern. In addition to keeping the language small, the unification has given a systematic treatment of all abstraction mechanisms and leads to a number of new possibilities. One of the interesting results of the unification is the notion of virtual class [7,8], which is the BETA mechanism for expressing genericity. A class may define an attribute in the form of a virtual class just as a class may define an attribute in the form of a virtual procedure. A subclass may then refine the definition of the virtual class attribute into a more specialized class. This is very much in the same way as a virtual procedure can be refined - resulting in a more specialized procedure. Virtual classes can be seen as an object-oriented version of generics. Other attempts to provide genericity for OO languages has been based on various forms of parametric polymorphism and function application rather than inheritance. Virtual classes have been used for more than 15 years in the BETA community and they have demonstrated their usefulness as a powerful abstraction mechanism. There has recently been an increasing interest in virtual classes and a number of proposals for adding virtual classes to other languages, extending virtual classes, and unifying virtual classes and parameterized classes have been made [1,2,3,13,14,15,16,17]. Another distinguishing feature of BETA is the notion of nested class [6]. The nested class construct originates already with Simula and is supported in a more general form in BETA. Nested classes have thus been available to the OO community for almost 4 decades, and the mechanism has found many uses in particular to structure large systems. Despite the usefulness, mainstream OO languages have not included general nesting mechanisms although C++ has a restricted form of nested classes, only working as a scoping mechanism. Recently nested classes has been added to the Java language. From a semantic analysis point of view the combination of inheritance, and general nesting adds some complexity to the semantic analysis, since the search space for names becomes two-dimensional. With virtual classes, the analysis becomes even more complicated – for details see ref. [10]. The unification of class and procedure has also lead to an inheritance mechanism for procedures [5] where method-combination is based on the inner-construct known from Simula. In BETA, patterns are first-class values, which implies that procedures as well as classes are first-class values. BETA also supports the notion of class-less objects, which has been adapted in the form of anonymous classes in Java. Finally, it