ABSTRACT
In mainstream OO languages, inheritance can be used to add new methods, or to override existing methods. Virtual classes and feature oriented programming are techniques which extend the mechanism of inheritance so that it is possible to refine nested classes as well. These techniques are attractive for programming in the large, because inheritance becomes a tool for manipulating whole class hierarchies rather than individual classes. Nevertheless, it has proved difficult to design static type systems for virtual classes, because virtual classes introduce dependent types. The compile-time type of an expression may depend on the run-time values of objects in that expression.We present a formal object calculus which implements virtual classes in a type-safe manner. Our type system uses a novel technique based on prototypes, which blur the distinction between compile-time and run-time. At run-time, prototypes act as objects, and they can be used in ordinary computations. At compile-time, they act as types. Prototypes are similar in power to dependent types, and subtyping is shown to be a form of partial evaluation. We prove that prototypes are type-safe but undecidable, and briefly outline a decidable semi-algorithm for dealing with them.
- M. Abadi and L. Cardelli. A Theory of Objects. Springer, 1996.]] Google Scholar
Digital Library
- D. Aspinall. Subtyping with singleton types. Eighth International Workshop on Computer Science Logic, 1994.]] Google Scholar
Digital Library
- D. Aspinall and A. Compagnoni. Subtyping dependent types. Proceedings of 11th Annual Symposium on Logic in Computer Science, 1996.]] Google Scholar
Digital Library
- L. Augustsson. Cayenne - a language with dependent types. International Conference on Functional Programming, pages 239--250, 1998.]] Google Scholar
Digital Library
- E. Barendsen and S. Smetsers. Uniqueness typing for functional languages with graph rewriting semantics. Mathematical Structures in Computer Science, 1996.]]Google Scholar
Cross Ref
- K. Barrett et al. A monotonic superclass linearization for dylan. Proceedings of OOPSLA, 1996.]] Google Scholar
Digital Library
- D. Batory, J. Liu, and J. Sarvela. Refinements and multi-dimensional separation of concerns. ACM SIGSOFT, 2003.]] Google Scholar
Digital Library
- D. Batory, J. Sarvela, and A. Rauschmayer. Scaling step-wise refinement. Proceedings of ICSE, 2003.]] Google Scholar
Digital Library
- G. Blaschek. Type-safe OOP with prototypes: the concepts of Omega. Structured Programming, 12(12):1--9, 1991.]]Google Scholar
- G. Bracha. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. Ph.D. thesis, University of Utah, 1992.]] Google Scholar
Digital Library
- G. Bracha and W. Cook. Mixin-based inheritance. OOPSLA, 1990.]] Google Scholar
Digital Library
- K. Bruce. Some challenging typing issues in object-oriented languages. Electronic Notes in Theoretical Computer Science 82 No. 8, 2003.]]Google Scholar
- K. Bruce, A. Fiech, and L. Petersen. Subtyping is not a good "match" for object-oriented languages. Proceedings of ECOOP, 1997.]]Google Scholar
Cross Ref
- K. B. Bruce, M. Odersky, and P. Wadler. A statically safe alternative to virtual types. Proceedings of ECOOP, 1998.]] Google Scholar
Digital Library
- P. Canning, W. Cook, W. Hill, and W. Olthoff. F-bounded polymorphism for object-oriented programming. Proceedings of FPLCA, 1989.]] Google Scholar
Digital Library
- G. Chen. Subtyping calculus of constructions (extended abstract). Proceedings of the International Symposium on Mathematical Foundations of Computer Science, 1997.]] Google Scholar
Digital Library
- D. Clarke, S. Drossopoulou, J. Noble, and T. Wrigstad. Tribe: More types for virtual classes. In submission, 2005.]]Google Scholar
- A. Compagnoni and B. Pierce. Higher-order intersection types and multiple inheritance. Mathematical Structures in Computer Science, 6 (5):469--501, 1996.]]Google Scholar
Cross Ref
- W. Cook, W. Hill, and P. Canning. Inheritance is not subtyping. Proceedings of POPL, 1990.]] Google Scholar
Digital Library
- T. Coquand and G. Huet. The calculus of constructions. Information and Computation, 1(2/3), 1988.]] Google Scholar
Digital Library
- P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. Proceedings of the 4th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pages 238--252, 1977.]] Google Scholar
Digital Library
- D. Dreyer, R. Harper, and K. Crary. Toward a practical type theory for recursive modules. Technical Report CMU-CS-01-112, 2001.]]Google Scholar
Cross Ref
- D. Duggan and C. Sourelis. Mixin modules. Proceedings of the International Conference on Functional Programming, 1996.]] Google Scholar
Digital Library
- E. Ernst. gbeta - a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. Ph.D. thesis. Department of Computer Science, University of Aarhus, Denmark, 1999.]]Google Scholar
- E. Ernst. Propagating class and method combination. Proceedings of ECOOP, 1999.]] Google Scholar
Digital Library
- E. Ernst. Family polymorphism. Proceedings of ECOOP, 2001.]] Google Scholar
Digital Library
- E. Ernst. Higher order hierarchies. Proceedings of ECOOP, 2003.]]Google Scholar
Cross Ref
- E. Ernst, K. Ostermann, and W. Cook. A virtual class calculus. Proceedings of POPL, 2006.]] Google Scholar
Digital Library
- M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. ACM Symposium on Principles of Programming Languages, 1998.]] Google Scholar
Digital Library
- D. Hutchins. The power of symmetry: Unifying inheritance and generative programming. OOPSLA Companion, DDD Track, 2003.]] Google Scholar
Digital Library
- A. Igarashi and B. Pierce. Foundations for virtual types. Proceedings of ECOOP, 1999.]] Google Scholar
Digital Library
- A. Igarashi, B. Pierce, and P. Wadler. Featherweight java, a minimal core calculus for java and gj. Proceedings of OOPSLA, 1999.]] Google Scholar
Digital Library
- A. Igarashi, C. Saito, and M. Viroli. Lightweight family polymorphism. Proceedings of the 3rd Asian Symposium on Programming Languages and Systems, 2005.]] Google Scholar
Digital Library
- P. Jolly, S. Drossopoulou, C. Anderson, and K. Ostermann. Simple dependent types: Concord. Proceedings of FTfJP, 2005.]]Google Scholar
- N. Jones, C. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Inc. Upper Saddle River, NJ, USA, 1993.]] Google Scholar
Digital Library
- N. D. Jones and A. J. Glenstrup. Program generation, termination, and binding-time analysis. Proceedings of GPCE, 2002.]] Google Scholar
Digital Library
- R. Lopez-Herrejon, D. Batory, and W. Cook. Evaluating support for features in advanced modularization technologies. Proceedings of ECOOP, 2005.]] Google Scholar
Digital Library
- Z. Luo. Computation and reasoning: a type theory for computer science. Oxford University Press, Inc., New York, NY, USA, 1994.]] Google Scholar
Digital Library
- O. Madsen and B. Møller-Pedersen. Virtual classes: A powerful mechanism in object-oriented programming. Proceedings of OOPSLA, 1989.]] Google Scholar
Digital Library
- C. McBride and J. McKinna. The view from the left. Journal of Functional Programming, 14(1):69--111, 2004.]] Google Scholar
Digital Library
- N. Nystrom, S. Chong, and A. Myers. Scalable extensibility via nested inheritance. Proceedings of OOPSLA, 2005.]] Google Scholar
Digital Library
- N. Nystrom, X. Qi, and A. Myers. J&: Nested intersection for scalable software composition. Proceedings of OOPSLA, 2006.]] Google Scholar
Digital Library
- M. Odersky, V. Cremet, C. Roeckl, and M. Zenger. A nominal theory of objects with dependent types. Proceedings of ECOOP, 2003.]]Google Scholar
Cross Ref
- W. H. Peri Tarr, H. Ossher. N degrees of separation: Multi-dimensional separation of concerns. Proceedings of ICSE, 1999.]] Google Scholar
Digital Library
- N. Schärli, S. Ducasse, O. Nierstrasz, and A. Black. Traits: Composable units of behavior. Proceedings of ECOOP, 2002.]]Google Scholar
- Y. Smaragdakis and D. Batory. Implementing layered designs with mixin layers. Proceedings of ECOOP, 1998.]] Google Scholar
Digital Library
- C. Stone. Singleton Kinds and Singleton Types. PhD thesis, Carnegie Mellon University, 2000.]] Google Scholar
Digital Library
- K. K. Thorup and M. Torgersen. Unifying genericity - combining the benefits of virtual types and parameterized classes. Proceedings of ECOOP, 1999.]] Google Scholar
Digital Library
- M. Torgersen. Virtual types are statically safe. 5th Workshop on Foundations of Object-Oriented Languages, 1998.]]Google Scholar
- M. Torgersen. The expression problem revisited. four new solutions using generics. Proceedings of ECOOP, 2004.]]Google Scholar
- D. Ungar and R. Smith. Self, the power of simplicity. Proceedings of OOPSLA, 1987.]] Google Scholar
Digital Library
- P. Wadler. The essence of functional programming. Proceedings POPL, 1992.]] Google Scholar
Digital Library
- A. Wright and M. Felleisen. A syntactic approach to type soundness. Information and Computation, 2004.]]Google Scholar
- H. Xi. Dependent Types in Practical Programming. PhD thesis, Carnegie Mellon University, 1998.]] Google Scholar
Digital Library
- M. Zenger and M. Odersky. Independently extensible solutions to the expression problem. Workshop on Foundations of Object-Oriented Languages, 2005.]]Google Scholar
- J. Zwanenburg. Pure type systems with subtyping. International Conference on Typed Lambda Calculi and Applications, 1999.]] Google Scholar
Digital Library
Index Terms
Eliminating distinctions of class: using prototypes to model virtual classes
Recommendations
A virtual class calculus
POPL '06: Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languagesVirtual classes are class-valued attributes of objects. Like virtual methods, virtual classes are defined in an object's class and may be redefined within subclasses. They resemble inner classes, which are also defined within a class, but virtual ...
Eliminating distinctions of class: using prototypes to model virtual classes
Proceedings of the 2006 OOPSLA ConferenceIn mainstream OO languages, inheritance can be used to add new methods, or to override existing methods. Virtual classes and feature oriented programming are techniques which extend the mechanism of inheritance so that it is possible to refine nested ...
The power of symmetry: unifying inheritance and generative programming
OOPSLA '03: Companion of the 18th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applicationsI present the Ohmu language, a unified object model which allows a number of "advanced" techniques such as aspects, mixin layers, parametric polymorphism, and generative components to be implemented cleanly using two basic concepts: block structure and ...







Comments