skip to main content
article
Open Access

Modular typechecking for hierarchically extensible datatypes and functions

Published:01 September 2004Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ancona, D. and Zucca, E. 2002. A calculus of module systems. J. Funct. Prog. 12, 2, 91--132 (March).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Arnold, K., Gosling, J., and Holmes, D. 2000. The Java Programming Language Third Edition. Addison-Wesley, Reading, MA, third edition.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bracha, G. and Cook, W. 1990. Mixin-based inheritance. In ECOOP/OOPSLA '90, 303--311.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Cardelli, L. 1988. A semantics of multiple inheritance. Information and Computation 76, 2/3, 138--164 (Feb).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. Cardelli, L. and Wegner, P. 1985. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv. 17, 4, 471--522 (Dec.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. Chambers, C. and Leavens, G. T. 1995. Typechecking and modules for multimethods. ACM Trans. Prog. Lang. Sys. 17, 6, 805--843 (Nov.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. Fuh, Y.-C. C. and Mishra, P. 1990. Type inference with subtypes. Theoretical Computer Science 73, 2, 155--175 (June).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Gamma, E., Helm, R., Johnson, R. E., and Vlissides, J. 1995. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Massachusetts.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Garrigue, J. 2000. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering, November.]]Google ScholarGoogle Scholar
  27. Gosling, J., Joy, B., Steele, G., and Bracha, G. 2000. The Java Language Specification Second Edition. The Java Series. Addison-Wesley, Boston, Mass.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. Millstein, T. 2003. Reconciling Software Extensibility with Modular Program Reasoning. Ph.D. dissertation, Department of Computer Science & Engineering, University of Washington.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. Millstein, T. and Chambers, C. 2002. Modular statically typed multimethods. Information and Computation 175, 1, 76--118 (May).]]Google ScholarGoogle ScholarCross RefCross Ref
  39. Milner, R., Tofte, M., Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (Revised). The MIT Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Nelson, G. 1991. Systems Programming with Modula-3. Prentice Hall.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  43. Pierce, B. C. and Turner, D. N. 2000. Local type inference. ACM Trans. Prog. Lang. Syst. 22, 1, 1--44 (Jan.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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 ScholarGoogle Scholar
  47. Shalit, A. 1997. The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language. Addison-Wesley, Reading, Mass.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. 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 ScholarGoogle Scholar
  49. Wright, A. K. and Felleisen, M. 1994. A syntactic approach to type soundness. Information and Computation 115, 1, 38--94, 15 (Nov.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Modular typechecking for hierarchically extensible datatypes and functions

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM Transactions on Programming Languages and Systems
                ACM Transactions on Programming Languages and Systems  Volume 26, Issue 5
                September 2004
                144 pages
                ISSN:0164-0925
                EISSN:1558-4593
                DOI:10.1145/1018203
                Issue’s Table of Contents

                Copyright © 2004 ACM

                Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 1 September 2004
                Published in toplas Volume 26, Issue 5

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader