ABSTRACT
By-name subtyping (or user-defined subtyping) and structural subtyping each have their own strengths and weaknesses. By-name subtyping allows programmers to explicitly express design intent, and, when types are associated with run time tags, enables run-time "type" tests and external/multimethod dispatch. On the other hand, structural subtyping is flexible and compositional, allowing unanticipated reuse. To date, nearly all object-oriented languages fully support only one subtyping paradigm or the other.
I propose a language that combines the key aspects of by-name and structural subtyping in a unified framework. The goal is to provide the flexibility of structural subtyping while still allowing static typechecking of external methods. The work offers a clean foundation for the designof future languages that enjoy the benefits of both by-name and structural subtyping.
I also propose a language extension to Java that combines by-name and structural subtyping, and includes parametric polymorphism. The practical utility of this language will be illustrated through case studies that show that code written in the new language is more flexible and easier to modify than the original code.
- Grzegorz Czajkowski, Laurent Dayn`es, and Ben Titzer. A multi-user virtual machine. In Proceedings of the General Track: 2003 USENIX Annual Technical Conference, pages 85--98, San Antonio, Texas, USA, June 2003. USENIX. Google ScholarDigital Library
- Galen Hunt et al. An overview of the Singularity project. Microsoft Research Technical Report MSR-TR-2005-135 MSR-TR-2005-135, Microsoft Research, 2005.Google Scholar
- Georgios Gousios. Jikesnode: A Java operating system. Master's thesis, University of Manchester, September 2004.Google Scholar
- Matthew Hertz, Yi Feng, and Emery D. Berger. Garbage collection without paging. In PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation, pages 143--153, New York, NY, USA, 2005. ACM Press. Google ScholarDigital Library
Index Terms
Combining structural subtyping and external dispatch
Recommendations
Combining structural subtyping and external dispatch
OOPSLA '07: Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companionThis paper presents the design of our language, Unity. Unity has a novel subtyping system that combines both by-name and structural subtyping. With this combination, Unity provides the flexiblity of structural subtyping while still allowing static ...
Parametric Subtyping for Structural Parametric Polymorphism
We study the interaction of structural subtyping with parametric polymorphism and recursively defined type constructors. Although structural subtyping is undecidable in this setting, we describe a notion of parametricity for type constructors and then ...
Decidable subtyping for path dependent types
Path dependent types have long served as an expressive component of the Scala programming language. They allow for the modelling of both bounded polymorphism and a degree of nominal subtyping. Nominality in turn provides the ability to capture first ...
Comments