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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
McIlroy, D.: Mass produced software components. In: [2], pp. 138–155
Naur, P., Randell, B. (eds.): Software Engineering: Report of a Conference Sponsored by the NATO Science Committee, Garmisch, Germany (1969)
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)
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)
Wadler, P.: The expression problem. Java Genericity Mailing list (November 1998)
Odersky, M., Zenger, M.: Independently extensible solutions to the expression problem. In: FOOL 2005 (2005)
Buchlovsky, P., Thielecke, H.: A type-theoretic reconstruction of the visitor pattern. In: MFPS XXI. Electronic Notes in Theoretical Computer Science (ENTCS) (2005)
Oliveira, B.C.d.S., Wang, M., Gibbons, J.: The visitor pattern as a reusable, generic, type-safe component. In: OOPSLA 2008 (2008)
Böhm, C., Berarducci, A.: Automatic synthesis of typed lambda-programs on term algebras. Theoretical Computer Science 39, 135–153 (1985)
Parigot, M.: Recursive programming with proofs. Theor. Comput. Sci. 94(2), 335–356 (1992)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
Girard, J.Y., Taylor, P., Lafont, Y.: Proofs and types. Cambridge University Press, Cambridge (1989)
Moors, A., Piessens, F., Odersky, M.: Generics of a higher kind. In: OOPSLA 2008 (2008)
Bracha, G., Cook, W.: Mixin-based inheritance. In: OOPSLA 1990, pp. 303–311. ACM Press, New York (1990)
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)
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)
Igarashi, A., Viroli, M.: Variant parametric types: A flexible subtyping scheme for generics. ACM Trans. Program. Lang. Syst. 28(5), 795–847 (2006)
Torgersen, M.: The expression problem revisited. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 123–146. Springer, Heidelberg (2004)
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)
Zenger, M., Odersky, M.: Extensible algebraic datatypes with defaults. In: ICFP 2001, pp. 241–252 (2001)
Löh, A., Hinze, R.: Open data types and open functions. In: PPDP 2006, pp. 133–144 (2006)
Poll, E.: Subtyping and inheritance for inductive types. In: Informal proceedings of the 1994 TYPES Workshop (1997)
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)
Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)
Cardelli, L.: Extensible records in a pure calculus of subtyping. In: Theoretical Aspects of Object-Oriented Programming, pp. 373–425. MIT Press, Cambridge (1994)
Cremet, V., Altherr, P.: Adding type constructor parameterization to Java. Journal of Object Technology 7(5), 25–65 (2008)
Odersky, M., et al.: An overview of the Scala programming language (2 nd edn.). Technical Report IC/2006/001, EPFL Lausanne, Switzerland (2006)
Chambers, C., Leavens, G.T.: Typechecking and modules for multimethods. ACM Transactions on Programming Languages and Systems 17(6), 805–843 (1995)
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)
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)
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)
Vlissides, J.: Pattern hatching - visitor in frameworks (1999)
Martin, R.C.: The Dependency Inversion Principle. The C++ Report (May 1996)
Ingalls, D.H.H.: A simple technique for handling multiple polymorphism. In: OOPSLA 1986, pp. 347–349 (1986)
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)
Bruce, K.B.: Some challenging typing issues in object-oriented languages. Electr. Notes Theor. Comput. Sci. 82(7) (2003)
Oliveira, B.C.d.S., Hinze, R., Löh, A.: Extensible and modular generics for the masses. In: TFP 2006, pp. 109–138 (2006)
Oliveira, B.C.d.S.: Genericity, Extensibility and Type-Safety in the Visitor Pattern. PhD thesis, University of Oxford (2007)
Swierstra, W.: Data types à la carte. Journal of Functional Programming 18(4), 423–436 (2008)
Garrigue, J.: Code reuse through polymorphic variants. In: Workshop on Foundations of Software Engineering, pp. 93–100 (2000)
Ernst, E.: The expression problem, Scandinavian style. In: Lahire, P., et al. (eds.) MASPEGHI 2004 (2004)
Nystrom, N., Chong, S., Myers, A.C.: Scalable extensibility via nested inheritance. In: OOPSLA 2004, pp. 99–115. ACM Press, New York (2004)
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)
Qi, X., Myers, A.C.: Sharing classes between families. In: PLDI 2009 (June 2009)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)