Abstract
One promising approach for adding object-oriented (OO) facilities to functional languages like ML is to generalize the existing datatype and function constructs to be hierarchical and extensible, so that datatype variants simulate classes and function cases simulate methods. This approach allows existing datatypes to be easily extended with both new operations and new variants, resolving a longstanding conflict between the functional and OO styles. However, previous designs based on this approach have been forced to give up modular typechecking, requiring whole-program checks to ensure type safety. We describe Extensible ML (EML), an ML-like language that supports hierarchical, extensible datatypes and functions while preserving purely modular typechecking. To achieve this result,EML's type system imposes a few requirements on datatype and function extensibility, but EML is still able to express both traditional functional and OO idioms. We have formalized a core version of EML and proven the associated type system sound, and we have developed a prototype interpreter for the language.
- Ancona, D., Lagorio, G., and Zucca, E. 2002. A formal framework for Java separate compilation. In Proceedings of the 2002 European Conference on Object-Oriented Programming, Lecture Notes in Computer Science, vol. 2374, Malaga, Spain (June). Springer-Verlag.]] Google ScholarDigital Library
- Ancona, D. and Zucca, E. 2001. True modules for Java-like languages. In J. L. Knudsen, Ed. ECOOP 2001--Object-Oriented Programming, Lecture Notes in Computer Science, vol. 2072. Springer.]] Google ScholarDigital Library
- Ancona, D. and Zucca, E. 2002. A calculus of module systems. J. Funct. Prog. 12, 2, 91--132 (March).]] Google ScholarDigital Library
- Arnold, K., Gosling, J., and Holmes, D. 2000. The Java Programming Language Third Edition. Addison-Wesley, Reading, MA, third edition.]] Google ScholarDigital Library
- Bonniot, D. 2002. Type-checking multi-methods in ML (a modular approach). In The Ninth International Workshop on Foundations of Object-Oriented Languages, FOOL 9, Portland, Oregon, USA (January).]]Google Scholar
- Bourdoncle, F. and Merz, S. 1997. Type-checking higher-order polymorphic multi-methods. In Conference Record of POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 302--315, Paris, France, 15--17 (Jan).]] Google ScholarDigital Library
- Bracha, G. and Cook, W. 1990. Mixin-based inheritance. In ECOOP/OOPSLA '90, 303--311.]] Google ScholarDigital Library
- Cardelli, L. 1988. A semantics of multiple inheritance. Information and Computation 76, 2/3, 138--164 (Feb).]] Google ScholarDigital Library
- Cardelli, L. 1997. Program fragments, linking, and modularization. In Conference Record of POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 266--277, Paris, France, 15--17 (Jan.).]] Google ScholarDigital Library
- Cardelli, L. and Wegner, P. 1985. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv. 17, 4, 471--522 (Dec.).]] Google ScholarDigital Library
- Chambers, C. and Chen, W. 1999. Efficient multiple and predicate dispatching. In L. Meissner, Ed. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA'99), volume 34.10 of ACM Sigplan Notices, 238--255, N.Y., Nov. 1--5. ACM Press.]] Google ScholarDigital Library
- Chambers, C. and Leavens, G. T. 1995. Typechecking and modules for multimethods. ACM Trans. Prog. Lang. Sys. 17, 6, 805--843 (Nov.).]] Google ScholarDigital Library
- Clifton, C., Leavens, G. T., Chambers, C., and Millstein, T. 2000. MultiJava: Modular open classes and symmetric multiple dispatch for Java. In OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, volume 35(10) of ACM SIGPLAN Notices, 130--145 (Oct.).]] Google ScholarDigital Library
- Cook, W. R. 1991. Object-oriented programming versus abstract data types. In J. W. de Bakker, W. P. de Roever, and G. Rozenberg, Eds. Foundations of Object-Oriented Languages, REX School/Workshop, Noordwijkerhout, The Netherlands, May/June, LNCS 489, 151--178. Springer-Verlag, New York, NY.]] Google ScholarDigital Library
- Drossopoulou, S., Eisenbach, S., and Wragg, D. 1999. A fragment calculus---towards a model of separate compilation, linking and binary compatibility. In Logic in Computer Science, 147--156.]] Google ScholarDigital Library
- Duggan, D. and Sourelis, C. 1996. Mixin modules. In Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming, 262--273, Philadelphia, Pennsylvania (May).]] Google ScholarDigital Library
- Duggan, D. and Techaubol, C.-C. 2001. Modular mixin-based inheritance for application frameworks. In Proceedings of the OOPSLA '01 conference on Object Oriented Programming Systems Languages and Applications, 223--240. ACM Press.]] Google ScholarDigital Library
- Ernst, M., Kaplan, C., and Chambers, C. 1998. Predicate dispatching: A unified theory of dispatch. In E. Jul, Ed. ECOOP '98--Object-Oriented Programming, Lecture Notes in Computer Science, vol. 1445, 186--211. Springer.]] Google ScholarDigital Library
- Findler, R. B. and Flatt, M. 1998. Modular object-oriented programming with units and mixins. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP '98), 34(1) of ACM SIGPLAN Notices, 94--104. ACM (June).]] Google ScholarDigital Library
- Fisher, K. and Reppy, J. 1999. The design of a class mechanism for MOBY. In Proceedings of the ACM SIGPLAN '99 Conference on Programming Language Design and Implementation, 37--49, Atlanta, Georgia (May 1--4).]] Google ScholarDigital Library
- Fisher, K. and Reppy, J. 2000. Extending Moby with inheritance-based subtyping. In 14th European Conference on Object-Oriented Programming, LNCS 1850, 83--107 (June).]] Google ScholarDigital Library
- Flatt, M. and Felleisen, M. 1998. Units: Cool modules for HOT languages. In Proceedings of the ACM SIGPLAN'98 Conference on Programming Language Design and Implementation (PLDI), 236--248, Montreal, Canada (17--19 June).]] Google ScholarDigital Library
- Flatt, M., Krishnamurthi, S., and Felleisen, M. 1998. Classes and mixins. In Conference Record of POPL 98: The 25TH ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Diego, California, 171--183, New York, NY.]] Google ScholarDigital Library
- Fuh, Y.-C. C. and Mishra, P. 1990. Type inference with subtypes. Theoretical Computer Science 73, 2, 155--175 (June).]] Google ScholarDigital Library
- Gamma, E., Helm, R., Johnson, R. E., and Vlissides, J. 1995. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Massachusetts.]] Google ScholarDigital Library
- Garrigue, J. 2000. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering, November.]]Google Scholar
- Gosling, J., Joy, B., Steele, G., and Bracha, G. 2000. The Java Language Specification Second Edition. The Java Series. Addison-Wesley, Boston, Mass.]] Google ScholarDigital Library
- Hirschowitz, T. and Leroy, X. 2002. Mixin modules in a call-by-value setting. In D. Le Métayer, Ed, Programming Languages and Systems, ESOP'2002, volume 2305 of Lecture Notes in Computer Science, 6--20. Springer-Verlag.]] Google ScholarDigital Library
- Hoang, M. and Mitchell, J. C. 1995. Lower bounds on type inference with subtypes. In Conference Record of POPL '95: 22nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, Calif., 176--185, New York, NY (Jan.) ACM.]] Google ScholarDigital Library
- Igarashi, A., Pierce, B. C., and Wadler, P. 2001. Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems 23, 3, 396--450, May.]] Google ScholarDigital Library
- Kahrs, S., Sannella, D., and Tarlecki, A. 1997. The definition of extended ML: A gentle introduction. Theoretical Computer Science 173, 2, 445--484, 28(Feb.).]] Google ScholarDigital Library
- Krishnamurthi, S., Felleisen, M., and Friedman, D. P. 1998. Synthesizing object-oriented and functional design to promote re-use. In E. Jul, Ed. ECOOP'98--Object-Oriented Programming, 12th European Conference, Brussels, Belgium, Lecture Notes in Computer Science, vol. 1445, 91--113. Springer-Verlag (July).]] Google ScholarDigital Library
- MacQueen, D. 1984. Modules for standard ML. In Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming, 198--207. ACM (Aug.).]] Google ScholarDigital Library
- McDirmid, S., Flatt, M., and Hsieh, W. C. 2001. Jiazzi: new-age components for old-fashioned java. In Proceedings of the OOPSLA '01 conference on Object Oriented Programming Systems Languages and Applications, 211--222. ACM Press.]] Google ScholarDigital Library
- Millstein, T. 2003. Reconciling Software Extensibility with Modular Program Reasoning. Ph.D. dissertation, Department of Computer Science & Engineering, University of Washington.]] Google ScholarDigital Library
- Millstein, T., Bleckner, C., and Chambers, C. 2002. Modular typechecking for hierarchically extensible datatypes and functions. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP '02), volume 37(9) of ACM SIGPLAN Notices, 110--122, New York, NY (Sept.) ACM.]] Google ScholarDigital Library
- Millstein, T. and Chambers, C. 1999. Modular statically typed multimethods. In R. Guerraoui, editor, ECOOP '99 -- Object-Oriented Programming 13th European Conference, Lisbon Portugal, Lecture Notes in Computer Science, vol. 1628, 279--303. Springer-Verlag, New York, NY (June).]] Google ScholarDigital Library
- Millstein, T. and Chambers, C. 2002. Modular statically typed multimethods. Information and Computation 175, 1, 76--118 (May).]]Google ScholarCross Ref
- Milner, R., Tofte, M., Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (Revised). The MIT Press.]] Google ScholarDigital Library
- Nelson, G. 1991. Systems Programming with Modula-3. Prentice Hall.]] Google ScholarDigital Library
- Nordlander, J. 1999. Pragmatic subtyping in polymorphic languages. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP '98), 34, 1, 216--227.]] Google ScholarDigital Library
- Odersky, M. and Wadler, P. 1997. Pizza into Java: Translating theory into practice. In Conference Record of POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 146--159, Paris, France, 15--17 (Jan.).]] Google ScholarDigital Library
- Pierce, B. C. and Turner, D. N. 2000. Local type inference. ACM Trans. Prog. Lang. Syst. 22, 1, 1--44 (Jan.).]] Google ScholarDigital Library
- Rémy, D. and Vouillon, J. 1998. Objective ML: An effective object-oriented extension of ML. Theory and Practice of Object Systems 4, 1, 27--52.]] Google ScholarDigital Library
- Reppy, J. and Riecke, J. 1996. Simple objects for Standard ML. In Proceedings of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation, 171--180, Philadelphia, Pennsylvania, 21--24 (May).]] Google ScholarDigital Library
- Reynolds, J. C. 1978. User defined types and procedural data structures as complementary approaches to data abstraction. In D. Gries, editor, Programming Methodology, A Collection of Articles by IFIP WG2.3, 309--317. Springer-Verlag, New York, NY.]]Google Scholar
- Shalit, A. 1997. The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language. Addison-Wesley, Reading, Mass.]] Google ScholarDigital Library
- Wadler, P. 1990. Linear types can change the world! In M. Broy and C. Jones, editors, IFIP TC 2 Working Conference on Programming Concepts and Methods, Sea of Galilee, Israel, 7--359. North Holland (Apr.).]]Google Scholar
- Wright, A. K. and Felleisen, M. 1994. A syntactic approach to type soundness. Information and Computation 115, 1, 38--94, 15 (Nov.).]] Google ScholarDigital Library
- Zenger, M., and Odersky, M. 2001. Extensible algebraic datatypes with defaults. In Proceedings of the 2001 ACM SIGPLAN International Conference on Functional Programming. ACM (September) 3--5.]] Google ScholarDigital Library
Index Terms
- Modular typechecking for hierarchically extensible datatypes and functions
Recommendations
Modular typechecking for hierarchically extensible datatypes and functions
ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programmingOne promising approach for adding object-oriented (OO) facilities to functional languages like ML is to generalize the existing datatype and function constructs to be hierarchical and extensible, so that datatype variants simulate classes and function ...
Modular typechecking for hierarchically extensible datatypes and functions
One promising approach for adding object-oriented (OO) facilities to functional languages like ML is to generalize the existing datatype and function constructs to be hierarchical and extensible, so that datatype variants simulate classes and function ...
Expressive and modular predicate dispatch for Java
Predicate dispatch is an object-oriented (OO) language mechanism for determining the method implementation to be invoked upon a message send. With predicate dispatch, each method implementation includes a predicate guard specifying the conditions under ...
Comments