Modular Visitor Components: A Practical Solution to the Expression Families Problem

The expression families problem can be defined as the problem of achieving reusability and composability across the components involved in a family of related datatypes and corresponding operations over those datatypes. Like the traditional expression problem, adding new components (either variants or operations) should be possible while preserving modular and static type-safety. Moreover, different combinations of components should have different type identities and the subtyping relationships between components should be preserved. By generalizing previous work exploring the connection between type-theoretic encodings of datatypes and visitors, we propose two solutions for this problem in Scala using modular visitor components. These components can be grouped into features that can be easily composed in a feature-oriented programming style to obtain customized datatypes and operations.

[1]  Erik Poll,et al.  Subtyping and Inheritance for Inductive Types , 1997 .

[2]  Jacques Garrigue,et al.  Code reuse through polymorphic variants , 2000 .

[3]  Hayo Thielecke,et al.  A Type-theoretic Reconstruction of the Visitor Pattern , 2006, MFPS.

[4]  Michel Parigot Recursive Programming with Proofs , 1992, Theor. Comput. Sci..

[5]  Meng Wang,et al.  The visitor pattern as a reusable, generic, type-safe component , 2008, OOPSLA.

[6]  Martin Odersky,et al.  Independently Extensible Solutions to the Expression Problem , 2004 .

[7]  Kim B. Bruce,et al.  PolyTOIL: A Type-Safe Polymorphic Object-Oriented Language , 1995, ECOOP.

[8]  Matthias Felleisen,et al.  Synthesizing Object-Oriented and Functional Design to Promote Re-Use , 1998, ECOOP.

[9]  Jens Palsberg,et al.  The essence of the Visitor pattern , 1998, Proceedings. The Twenty-Second Annual International Computer Software and Applications Conference (Compsac '98) (Cat. No.98CB 36241).

[10]  Gary T. Leavens,et al.  MultiJava: modular open classes and symmetric multiple dispatch for Java , 2000, OOPSLA '00.

[11]  Mirko Viroli,et al.  Variant parametric types: A flexible subtyping scheme for generics , 2006, ACM Trans. Program. Lang. Syst..

[12]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[13]  Roberto Erick Lopez-Herrejon,et al.  Evaluating Support for Features in Advanced Modularization Technologies , 2005, ECOOP.

[14]  Xin Qi,et al.  J&: nested intersection for scalable software composition , 2006, OOPSLA '06.

[15]  Erik Ernst The expression problem, Scandinavian style , 2004 .

[16]  Philippe Altherr,et al.  Adding Type Constructor Parameterization to Java , 2008, J. Object Technol..

[17]  Craig S. Kaplan,et al.  Predicate Dispatching: A Unified Theory of Dispatch , 1998, ECOOP.

[18]  Kim B. Bruce Some challenging typing issues in object-oriented languages , 2003, WOOD.

[19]  Xin Qi,et al.  Sharing classes between families , 2009, PLDI '09.

[20]  William R. Cook,et al.  Object-Oriented Programming Versus Abstract Data Types , 1990, REX Workshop.

[21]  Daniel H. H. Ingalls A simple technique for handling multiple polymorphism , 1986, OOPSLA 1986.

[22]  Martin Odersky,et al.  Generics of a higher kind , 2008, OOPSLA.

[23]  Wouter Swierstra,et al.  Data types à la carte , 2008, Journal of Functional Programming.

[24]  Corrado Böhm,et al.  Automatic Synthesis of Typed Lambda-Programs on Term Algebras , 1985, Theor. Comput. Sci..

[25]  Andrew C. Myers,et al.  Scalable extensibility via nested inheritance , 2004, OOPSLA.

[26]  Luca Cardelli,et al.  Extensible records in a pure calculus of subtyping , 1994 .

[27]  Ralf Hinze,et al.  Open data types and open functions , 2006, PPDP '06.

[28]  Brian Randell,et al.  Software engineering : report on a conference sponsored by the NATO Science Committee, Garmisch, Germany, 7th to 11th October 1968 , 1969 .

[29]  Bruno C. d. S. Oliveira,et al.  Extensible and modular generics for the masses , 2006, Trends in Functional Programming.

[30]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[31]  Apostolos Syropoulos,et al.  Steps in Scala: The expression problem , 2010 .

[32]  Oscar Nierstrasz,et al.  Traits: Composable Units of Behaviour , 2002, ECOOP.

[33]  Mads Torgersen The Expression Problem Revisited , 2004, ECOOP.

[34]  Martin Odersky,et al.  Extensible algebraic datatypes with defaults , 2001, ICFP '01.

[35]  Gary T. Leavens,et al.  Typechecking and Modules for Multimethods , 1995, ACM Trans. Program. Lang. Syst..

[36]  J. Girard,et al.  Proofs and types , 1989 .

[37]  Christian Prehofer,et al.  Feature-Oriented Programming: A Fresh Look at Objects , 1997, ECOOP.

[38]  John C. Reynolds User-defined types and procedural data structures as complementary approaches to data abstraction , 1994 .

[39]  William R. Cook,et al.  Mixin-based inheritance , 1990, OOPSLA/ECOOP '90.

[40]  Bruno César dos Santos Oliveira Genericity, extensibility and type : safety in the VISITOR pattern , 2007 .

[41]  Martin Odersky,et al.  An Overview of the Scala Programming Language Second Edition , 2006 .