Skip to main content

Modular Visitor Components

A Practical Solution to the Expression Families Problem

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5653))

Abstract

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.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. McIlroy, D.: Mass produced software components. In: [2], pp. 138–155

    Google Scholar 

  2. Naur, P., Randell, B. (eds.): Software Engineering: Report of a Conference Sponsored by the NATO Science Committee, Garmisch, Germany (1969)

    Google Scholar 

  3. Reynolds, J.C.: User-defined types and procedural data structures as complementary approaches to type abstraction. In: Schuman, S.A. (ed.) New Directions in Algorithmic Languages, Rocquencourt, pp. 157–168 (1975)

    Google Scholar 

  4. Cook, W.R.: Object-oriented programming versus abstract data types. In: Stein, J. (ed.) REX Workshop/School on the Foundations of Object-Oriented Languages. LNCS, vol. 173, pp. 151–178. Springer, Heidelberg (1990)

    Google Scholar 

  5. Wadler, P.: The expression problem. Java Genericity Mailing list (November 1998)

    Google Scholar 

  6. Odersky, M., Zenger, M.: Independently extensible solutions to the expression problem. In: FOOL 2005 (2005)

    Google Scholar 

  7. Buchlovsky, P., Thielecke, H.: A type-theoretic reconstruction of the visitor pattern. In: MFPS XXI. Electronic Notes in Theoretical Computer Science (ENTCS) (2005)

    Google Scholar 

  8. Oliveira, B.C.d.S., Wang, M., Gibbons, J.: The visitor pattern as a reusable, generic, type-safe component. In: OOPSLA 2008 (2008)

    Google Scholar 

  9. Böhm, C., Berarducci, A.: Automatic synthesis of typed lambda-programs on term algebras. Theoretical Computer Science 39, 135–153 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  10. Parigot, M.: Recursive programming with proofs. Theor. Comput. Sci. 94(2), 335–356 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  11. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)

    MATH  Google Scholar 

  12. Girard, J.Y., Taylor, P., Lafont, Y.: Proofs and types. Cambridge University Press, Cambridge (1989)

    MATH  Google Scholar 

  13. Moors, A., Piessens, F., Odersky, M.: Generics of a higher kind. In: OOPSLA 2008 (2008)

    Google Scholar 

  14. Bracha, G., Cook, W.: Mixin-based inheritance. In: OOPSLA 1990, pp. 303–311. ACM Press, New York (1990)

    Google Scholar 

  15. Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.: Traits: Composable units of behavior. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  16. Bruce, K., Schuett, A., van Gent, R., Fiech, A.: Polytoil: A type-safe polymorphic object-oriented language. ACM Trans. Program. Lang. Syst. 25(2), 225–290 (2003)

    Article  Google Scholar 

  17. Igarashi, A., Viroli, M.: Variant parametric types: A flexible subtyping scheme for generics. ACM Trans. Program. Lang. Syst. 28(5), 795–847 (2006)

    Article  Google Scholar 

  18. Torgersen, M.: The expression problem revisited. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 123–146. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  19. Clifton, C., Leavens, G.T., Chambers, C., Millstein, T.: MultiJava: Modular open classes and symmetric multiple dispatch for Java. In: OOPSLA 2000, pp. 130–145 (2000)

    Google Scholar 

  20. Zenger, M., Odersky, M.: Extensible algebraic datatypes with defaults. In: ICFP 2001, pp. 241–252 (2001)

    Google Scholar 

  21. Löh, A., Hinze, R.: Open data types and open functions. In: PPDP 2006, pp. 133–144 (2006)

    Google Scholar 

  22. Poll, E.: Subtyping and inheritance for inductive types. In: Informal proceedings of the 1994 TYPES Workshop (1997)

    Google Scholar 

  23. Lopez-Herrejon, R.E., Batory, D.S., Cook, W.R.: Evaluating support for features in advanced modularization technologies. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 169–194. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  24. Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)

    MATH  Google Scholar 

  25. Cardelli, L.: Extensible records in a pure calculus of subtyping. In: Theoretical Aspects of Object-Oriented Programming, pp. 373–425. MIT Press, Cambridge (1994)

    Google Scholar 

  26. Cremet, V., Altherr, P.: Adding type constructor parameterization to Java. Journal of Object Technology 7(5), 25–65 (2008)

    Article  Google Scholar 

  27. Odersky, M., et al.: An overview of the Scala programming language (2 nd edn.). Technical Report IC/2006/001, EPFL Lausanne, Switzerland (2006)

    Google Scholar 

  28. Chambers, C., Leavens, G.T.: Typechecking and modules for multimethods. ACM Transactions on Programming Languages and Systems 17(6), 805–843 (1995)

    Article  Google Scholar 

  29. Prehofer, C.: Feature-oriented programming: A fresh look at objects. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 419–443. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  30. Krishnamurthi, S., Felleisen, M., Friedman, D.P.: Synthesizing object-oriented and functional design to promote re-use. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 91–113. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  31. Palsberg, J., Jay, C.B.: The essence of the visitor pattern. In: Proc. 22nd IEEE Int. Computer Software and Applications Conf., COMPSAC, pp. 9–15 (19-21 1998)

    Google Scholar 

  32. Vlissides, J.: Pattern hatching - visitor in frameworks (1999)

    Google Scholar 

  33. Martin, R.C.: The Dependency Inversion Principle. The C++ Report (May 1996)

    Google Scholar 

  34. Ingalls, D.H.H.: A simple technique for handling multiple polymorphism. In: OOPSLA 1986, pp. 347–349 (1986)

    Google Scholar 

  35. Ernst, M., Kaplan, C., Chambers, C.: Predicate dispatching: A unified theory of dispatch. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 186–211. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  36. Bruce, K.B.: Some challenging typing issues in object-oriented languages. Electr. Notes Theor. Comput. Sci. 82(7) (2003)

    Google Scholar 

  37. Oliveira, B.C.d.S., Hinze, R., Löh, A.: Extensible and modular generics for the masses. In: TFP 2006, pp. 109–138 (2006)

    Google Scholar 

  38. Oliveira, B.C.d.S.: Genericity, Extensibility and Type-Safety in the Visitor Pattern. PhD thesis, University of Oxford (2007)

    Google Scholar 

  39. Swierstra, W.: Data types à la carte. Journal of Functional Programming 18(4), 423–436 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  40. Garrigue, J.: Code reuse through polymorphic variants. In: Workshop on Foundations of Software Engineering, pp. 93–100 (2000)

    Google Scholar 

  41. Ernst, E.: The expression problem, Scandinavian style. In: Lahire, P., et al. (eds.) MASPEGHI 2004 (2004)

    Google Scholar 

  42. Nystrom, N., Chong, S., Myers, A.C.: Scalable extensibility via nested inheritance. In: OOPSLA 2004, pp. 99–115. ACM Press, New York (2004)

    Google Scholar 

  43. Nystrom, N., Qi, X., Myers, A.C.: J&: nested intersection for scalable software composition. In: OOPSLA 2006, pp. 21–36. ACM Press, New York (2006)

    Google Scholar 

  44. Qi, X., Myers, A.C.: Sharing classes between families. In: PLDI 2009 (June 2009)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Oliveira, B.C.d.S. (2009). Modular Visitor Components. In: Drossopoulou, S. (eds) ECOOP 2009 – Object-Oriented Programming. ECOOP 2009. Lecture Notes in Computer Science, vol 5653. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03013-0_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-03013-0_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-03012-3

  • Online ISBN: 978-3-642-03013-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics