Advertisement

Solving the Expression Problem in C++, á la LMS

  • Seyed Hossein HaeriEmail author
  • Paul Keir
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11884)

Abstract

We give a C++ solution to the Expression Problem that takes a components-for-cases approach. Our solution is a C++ transliteration of how Lightweight Modular Staging solves the Expression Problem. It, furthermore, gives a C++ encoding to object algebras and object algebra interfaces. We use our latter encoding by tying its recursive knot as in Datatypes à la Carte.

Supplementary material

References

  1. 1.
    Bahr, P., Hvitved, T.: Compositional data types. In: Järvi, J., Mu, S.-C. (eds.) 7th WGP, Tokyo, Japan, pp. 83–94. ACM, September 2011Google Scholar
  2. 2.
    Bahr, P., Hvitved, T.: Parametric compositional data types. In: Chapman, J., Levy, P.B. (eds.) 4th MSFP. ENTCS, vol. 76, pp. 3–24, February 2012CrossRefGoogle Scholar
  3. 3.
    Black, A.P.: The expression problem, gracefully. In: Sakkinen, M. (ed.) MASPEGHI@ECOOP 2015, pp. 1–7. ACM, July 2015Google Scholar
  4. 4.
    Canning, P., Cook, W.R., Hill, W., Olthoff, W., Mitchell, J.C.: F-bounded polymorphism for object-oriented programming. In: 4th FPCA, pp. 273–280, September 1989Google Scholar
  5. 5.
    Chlipala, A.: Parametric higher-order abstract syntax for mechanized semantics. In: Hook, J., Thiemann, P. (eds.) 13th ICFP, Victoria, BC, Canada, pp. 143–156, September 2008Google Scholar
  6. 6.
    Cook, W.R.: Object-oriented programming versus abstract data types. In: de Bakker, J.W., de Roever, W.P., Rozenberg, G. (eds.) REX 1990. LNCS, vol. 489, pp. 151–178. Springer, Heidelberg (1991).  https://doi.org/10.1007/BFb0019443CrossRefGoogle Scholar
  7. 7.
    Cook, W.R., Hill, W.L., Canning, P.S.: Inheritance is not Subtyping. In: 17th POPL, San Francisco, CA, USA, pp. 125–135. ACM (1990)Google Scholar
  8. 8.
    Ernst, E., Ostermann, K., Cook, W.R.: A virtual class calculus. In: Morrisett, J.G., Peyton Jones, S.L. (eds.) 33rd POPL, pp. 270–282. ACM, January 2006CrossRefGoogle Scholar
  9. 9.
    Garrigue, J.: Code reuse through polymorphic variants. In: FSE, vol. 25, pp. 93–100 (2000)Google Scholar
  10. 10.
    Guttag, J.V., Horning, J.J.: The algebraic specification of abstract data types. Acta Inform. 10, 27–52 (1978)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Haeri, S.H.: Component-based mechanisation of programming languages in embedded settings. Ph.D. thesis, STS, TUHH, Germany, December 2014Google Scholar
  12. 12.
    Haeri, S.H., Keir, P.W.: Metaprogramming as a Solution to the Expression Problem, November 2019Google Scholar
  13. 13.
    Haeri, S.H., Keir, P.W.: Multiple dispatch using compile-time metaprogramming. Submitted to 16th ICTAC, November 2019Google Scholar
  14. 14.
    Haeri, S.H., Schupp, S.: Reusable components for lightweight mechanisation of programming languages. In: Binder, W., Bodden, E., Löwe, W. (eds.) SC 2013. LNCS, vol. 8088, pp. 1–16. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-39614-4_1CrossRefGoogle Scholar
  15. 15.
    Haeri, S.H., Schupp, S.: Expression compatibility problem. In: Davenport, J.H., Ghourabi, F. (eds.) 7th SCSS. EPiC Comp., vol. 39, pp. 55–67. EasyChair, March 2016Google Scholar
  16. 16.
    Haeri, S.H., Schupp, S.: Integration of a decentralised pattern matching: venue for a new paradigm intermarriage. In: Mosbah, M., Rusinowitch, M. (eds.) 8th SCSS. EPiC Comp., vol. 45, pp. 16–28. EasyChair, April 2017Google Scholar
  17. 17.
    Hofer, C., Ostermann, K., Rendel, T., Moors, A.: Polymorphic embedding of DSLs. In: Smaragdakis, Y., Siek, J.G. (eds.) 7th GPCE, Nashville, TN, USA, pp. 137–148. ACM, October 2008Google Scholar
  18. 18.
    Kennedy, A., Russo, C.V.: Generalized algebraic data types and object-oriented programming. In: Johnson, R.E., Gabriel, R.P. (eds.) 20th OOPSLA, San Diego, CA, USA, pp. 21–40. ACM, October 2005Google Scholar
  19. 19.
    Meijer, E., Hutton, G.: Bananas in space: extending fold and unfold to exponential types. In: Williams, J. (ed.) 7th FPCA, La Jolla, California, USA, pp. 324–333. ACM, June 1995Google Scholar
  20. 20.
    Odersky, M., Zenger, M.: Independently extensible solutions to the expression problem. In: FOOL, January 2005Google Scholar
  21. 21.
    Odersky, M., Zenger, M.: Scalable component abstractions. In: 20th OOPSLA, San Diego, CA, USA, pp. 41–57. ACM (2005)Google Scholar
  22. 22.
    Oliveira, B.C.d.S.: Modular visitor components. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 269–293. Springer, Heidelberg (2009).  https://doi.org/10.1007/978-3-642-03013-0_13Google Scholar
  23. 23.
    Oliveira, B.C.d.S., Cook, W.R.: Extensibility for the masses - practical extensibility with object algebras. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 2–27. Springer, Heidelberg (2012).  https://doi.org/10.1007/978-3-642-31057-7_2CrossRefGoogle Scholar
  24. 24.
    Oliveira, B.C.d.S., Moors, A., Odersky, M.: Type classes as objects and implicits. In: Cook, W.R., Clarke, S., Rinard, M.C. (eds.) 25th OOPSLA, pp. 341–360. ACM, October 2010Google Scholar
  25. 25.
    Oliveira, B.C.d.S., Mu, S.-C., You, S.-H.: Modular reifiable matching: a list-of-functors approach to two-level types. In: Lippmeier, B. (ed.) 8th Haskell, pp. 82–93. ACM, September 2015Google Scholar
  26. 26.
    Oliveira, B.C.d.S., van der Storm, T., Loh, A., Cook, W.R.: Feature-oriented programming with object algebras. In: Castagna, G. (ed.) ECOOP 2013. LNCS, vol. 7920, pp. 27–51. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-39038-8_2CrossRefGoogle Scholar
  27. 27.
    Ostermann, K.: Dynamically composable collaborations with delegation layers. In: Magnusson, B. (ed.) ECOOP 2002. LNCS, vol. 2374, pp. 89–110. Springer, Heidelberg (2002).  https://doi.org/10.1007/3-540-47993-7_4CrossRefGoogle Scholar
  28. 28.
    O’Sullivan, B., Goerzen, J., Stewart, D.: Real World Haskell: Code You Can Believe in. O’Reilly, Sebastopol (2008)Google Scholar
  29. 29.
    Pressman, R.S.: Software Engineering: A Practitioner’s Approach, 7th edn. McGraw-Hill, New York (2009)zbMATHGoogle Scholar
  30. 30.
    Rendel, T., Brachthäuser, J.I., Ostermann, K.: From object algebras to attribute grammars. In: Black, A.P., Millstein, T.D. (eds.) 28th OOPSLA, pp. 377–395. ACM, October 2014Google Scholar
  31. 31.
    Reynolds, J.C.: User-defined types and procedural data structures as complementary approaches to type abstraction. In: Schuman, S.A. (ed.) New Direc. Algo. Lang., pp. 157–168. INRIA (1975)Google Scholar
  32. 32.
    Rompf, T., Odersky, M.: Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs. In: 9th GPCE, Eindhoven, Holland, pp. 127–136. ACM (2010)Google Scholar
  33. 33.
    Sommerville, I.: Software Engineering, 9th edn. Addison-Wesley, Reading (2011)Google Scholar
  34. 34.
    Swierstra, W.: Data types à la Carte. JFP 18(4), 423–436 (2008)MathSciNetzbMATHGoogle Scholar
  35. 35.
    Torgersen, M.: The expression problem revisited. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 123–146. Springer, Heidelberg (2004).  https://doi.org/10.1007/978-3-540-24851-4_6CrossRefGoogle Scholar
  36. 36.
    Vandevoorde, D., Josuttis, N.M., Gregor, D.: C++ Templates: The Complete Guide, 2nd edn. Addison Wesley, Reading (2017)Google Scholar
  37. 37.
    Wadler, P.: The Expression Problem. Java Genericity Mailing List, November 1998Google Scholar
  38. 38.
    Wang, Y., Oliveira, B.C.d.S.: The expression problem, Trivially! In: 15th MODULARITY, pp. 37–41. ACM, New York (2016)Google Scholar
  39. 39.
    Zenger, M., Odersky, M.: Extensible algebraic datatypes with defaults. In: 6th ICFP, pp. 241–252, Florence, Italy. ACM (2001)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Université catholique de LouvainLouvain-la-NeuveBelgium
  2. 2.University of the West of ScotlandGlasgowUK

Personalised recommendations