ABSTRACT
A major problem for writing extensible software arises when recursively defined datatypes and operations on these types have to be extended simultaneously without modifying existing code. This paper introduces Extensible Algebraic Datatypes with defaults, which promote a simple programming pattern to solve this well-known problem. We show that it is possible to encode extensible algebraic datatypes in an object-oriented language, using a new design pattern for extensible visitors. Extensible algebraic datatypes have been successfully applied in the implementation of an extensible Java compiler. Our technique allows for the reuse of existing components in compiler extensions without the need for any adaptations.
- A. Appel, L. Cardelli, K. Crary, K. Fisher, C. Gunter, R. Harper, X. Leroy, M. Lillibridge, D. B. MacQueen, J. Mitchell, G. Morrisett, J. H. Reppy, J. G. Riecke, Z. Shao, and C. A. Stone. Principles and preliminary design for ML2000. March 1999.Google Scholar
- M. Bchi and W. Weck. Compound types for lava. In Proc. of OOPSLA '98. pages 362-373, October 1998. Google ScholarDigital Library
- L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. Computing Surveys, 17(4):471-522, December 1985. Google ScholarDigital Library
- D. Cavin. Synchronous Java compiler. Projet do so' instre. Ecole Polyto(Imique Federate de Lausanne, S wit zerland, February 2000.Google Scholar
- C. Clifton, G. T. Leavens, C. Chambers, and T. Millstein. MultiJava: Modular open classes oand svtrtinetric multiple dispatch for java. In Proceedings it! OOPSLA 2000, volume 35, pages 130 145. October 2000. Google ScholarDigital Library
- W. R. Cook. Object-oniented programming versus abstract data types. In Foundations of Object-Oriented Languages. REX School/Workshop, .Vooidwijkerhout. 'Pie Netherlands. 1990. volume 489, Joiges 151-178. Springer-Verlag, New York. NY, 1991. Google ScholarDigital Library
- D. Duggan and C. Sourelis. Mixin modules. In Pioreedings of the 1996 ACM SICPLAN International Conference on Functional Programin-ing. pages 262 273. Philadelphia. Pennsylvania. 24 26 May 1996. Google ScholarDigital Library
- P. Eugster, R. Guerraoui, and C. Damm. Oil object and events. In Proceedings for OOPSLA 2001, Tampa Bay. Florida, October 2001.Google Scholar
- R. B. Findler. Modular abstract interpreters. Unpublished mat Ill script , Carnegie Mellon University. June 1995.Google Scholar
- R. B. Findler and M. Flatt. Modular object-oriented programmuig with units and inixins. In Proceedings of the ACM SIGPLAN International Confeir-oce on 1- oi,ct,onal Programming (JCFP '98). volume 3-1(1). 94-104, 1999. Google ScholarDigital Library
- M. Flatt. Programming Languages for Reusable Software Components. PhD thesis, Rice University. Department of Computer Science, June 1999. Google ScholarDigital Library
- C. Fournet and G. Gonthier. The reflexive chemical abstract nmr'hint' and I lie join-calculus. In Proc. 23rd .4 Cii Symposium On Principlcs of Programming Languages. pages 372--385. Jan. 1996. Google ScholarDigital Library
- E. Gagnon and L. J. Hendren. SableCC -an object-oriented compiler framework. In Proceedings of TOOLS 1998. August 1998. Google ScholarDigital Library
- E. Gamma, R. Helm, R. Johnson, and T. Vlissides. Design Pattterns: Element of Reusable Object-Oriented Software. Addison-Wesley, 1994. Google ScholarDigital Library
- J . Garrigue. Programming with polymorphic variants. In ML Works/top. Septeillber 1998.Google Scholar
- J. Garrigue. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering. Sasaguri, Japan, November 2000.Google Scholar
- J. Gosling. The evolution of numerical computing in Java, Sun Microsystems Laboratories. http://java.sun.com/people/jag/FP. html.Google Scholar
- J. Gosling, B. Joy, G. Steele, and G. Bracha. The java language specification. java series, Sun Microsystems, second edition. 2000. ISBN 0-201-3100S-2. Google ScholarDigital Library
- S. Krishnamurthi, M. Felleisen, and D. Friedman. Synthesizing object-oriented and functional design to promote re-use. In European Conference on Object-Oriented Programming, pages 91-113, 1998. Google ScholarDigital Library
- X. Leroy, D. Doligez, J. Garrigue, D. Rmy, and J. Vouillon. The Objective Carol system release 3.00, documentation and user's manual, April 2000.Google Scholar
- S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In Symposium on Principles of Programming Languages, pages 333-343, January 1992. Google ScholarDigital Library
- P. Menp and K. Oksanen. Extensible algebraic datatypes through prototypes and subtyping. Unpublished. 2000.Google Scholar
- M. Odersky and M. Philippsen. EspressoGriimder distribution. littp://wwwipd.ira.uka.de/espresso, Dec. 1995.Google Scholar
- M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In Proc. 24th ACM Symposium on Principles of Programing Languages, pages 146--159. January 1997. Google ScholarDigital Library
- J. Palsberg and C. B. Jay. The essence of the visitor pattern. Technical Report 5, University of Technology, Sydney 1997Google Scholar
- C. Petitpierre. A case for synchronous objects ill compound-bound architect umrcs, Unpublished. Ecole Polytechnique Fddrale de Lausanne, 2000.Google Scholar
- M. Philippsen and M. Zenger. JavaParty transparent remote objects ill Java. Concurrency: Practice and experience, 9(11):1225 1242. November 1998.Google Scholar
- J. Reppy and J. Riecke, Simple objects for Standard ML. In Proc. of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation. pages 171-180. Philadelphia, Pennsylvania, 1996. Google ScholarDigital Library
- Y. Roudier and Y. lchisugi . Mixin composition strategies for the modular implementation of aspect weaving the EPI preprocessor and it's module description language. In A spcct Oriented Programming Workshop at IcSE98.April 1998.Google Scholar
- P. Wadler and et- al. The expression problem. Discussion on the Java-Cenerieity mailing list, December 1998.Google Scholar
- N. Wirth. Complier Construction. Addison-Wesley, 1996. Google ScholarDigital Library
- M. Zenger. JaCo distribution. http: //lampwww.epfl.ch/jaco/.University of South Australia. Adelaide. November 1998.Google Scholar
- M. Zenger. Erweiterbare Uhersetzer. Master's thesis. University of Karlsruhe. August 1998.Google Scholar
- M. Zenger and M. Odersky. Implementing extensible compilers. in Proceedings of the ECOOP 2001 Workshop on Multiparadigm Programnmnzng with Object-Oriented Languages. pages 61 80. Budapest. Hungary, June 2001.Google Scholar
- S. Zermatten. Compound Types in Java. Projet de semestre. cole Polvtechnique F6.d6rale de Lausanne, Switzerland, little 2000. http: //lampwww epfl.ch/jaco/cjava. htmlGoogle Scholar
Index Terms
- Extensible algebraic datatypes with defaults
Recommendations
Extensible algebraic datatypes with defaults
A major problem for writing extensible software arises when recursively defined datatypes and operations on these types have to be extended simultaneously without modifying existing code. This paper introduces Extensible Algebraic Datatypes with ...
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 ...
Comments