λ-Based Object-Oriented Programming (Pearl)

Authors Marco Servetto , Elena Zucca



PDF
Thumbnail PDF

File

LIPIcs.ECOOP.2021.21.pdf
  • Filesize: 0.76 MB
  • 16 pages

Document Identifiers

Author Details

Marco Servetto
  • ECS, Victoria University of Wellington, New Zealand
Elena Zucca
  • DIBRIS, University of Genova, Italy

Acknowledgements

We warmly thank the anonymous referees for suggestions which greatly improved the paper.

Cite AsGet BibTex

Marco Servetto and Elena Zucca. λ-Based Object-Oriented Programming (Pearl). In 35th European Conference on Object-Oriented Programming (ECOOP 2021). Leibniz International Proceedings in Informatics (LIPIcs), Volume 194, pp. 21:1-21:16, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2021)
https://doi.org/10.4230/LIPIcs.ECOOP.2021.21

Abstract

We show that a minimal subset of Java 8 excluding classes supports a simple and natural programming style, which we call λ-based object-oriented programming. That is, on one hand the programmer can use tuples in place of objects (class instances), and tuples can be desugared to lambdas following their classical encoding in the λ-calculus. On the other hand, lambdas can be equipped with additional behaviour, thanks to the fact that they may implement interfaces with default methods, hence inheritance and dynamic dispatch are still supported. We formally describe the encoding by a translation from FJλ, an FJ variant including lambdas and interfaces with default methods, to FJλ-, a subset of FJλ with no classes (hence no constructors and fields). We provide several examples illustrating this novel programming style.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Object oriented languages
  • Software and its engineering → Functional languages
Keywords
  • Programming paradigms
  • Java
  • lambda-calculus

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Jonathan Aldrich. The power of interoperability: why objects are inevitable. In Antony L. Hosking, Patrick Th. Eugster, and Robert Hirschfeld, editors, ACM Symposium on New Ideas in Programming and Reflections on Software, Onward! 2013, part of SPLASH'13, pages 101-116. ACM Press, 2013. URL: https://doi.org/10.1145/2509578.2514738.
  2. Lorenzo Bettini, Viviana Bono, Mariangiola Dezani-Ciancaglini, Paola Giannini, and Betti Venneri. Java & Lambda: a Featherweight story. Logical Methods in Computer Science, 14(3), 2018. URL: https://doi.org/10.23638/LMCS-14(3:17)2018.
  3. Lorenzo Bettini, Ferruccio Damiani, Ina Schaefer, and Fabio Strocco. TraitRecordJ: A programming language with traits and records. Science of Computer Programming, 78(5):521-541, 2013. URL: https://doi.org/10.1016/j.scico.2011.06.007.
  4. Kim B. Bruce, Luca Cardelli, and Benjamin C. Pierce. Comparing object encodings. Information and Computation, 155(1-2):108-133, 1999. URL: https://doi.org/10.1006/inco.1999.2829.
  5. Peter Buchlovsky and Hayo Thielecke. A type-theoretic reconstruction of the visitor pattern. Electronic Notes in Theoretical Computer Science, 155:309-329, 2006. Mathematical Foundations of Programming Semantics - MFPS 2005. URL: https://doi.org/10.1016/j.entcs.2005.11.061.
  6. Francesco Dagnino, Viviana Bono, Elena Zucca, and Mariangiola Dezani-Ciancaglini. Soundness conditions for big-step semantics. In Peter Müller, editor, Programming Languages and Systems - 29th European Symposium on Programming - ESOP 2020, volume 12075 of Lecture Notes in Computer Science, pages 169-196. Springer, 2020. URL: https://doi.org/10.1007/978-3-030-44914-8_7.
  7. Michael Homer, Timothy Jones, and James Noble. First-class dynamic types. In Dynamic Languages Symposium 2019, pages 1-19. ACM Press, 2019. URL: https://doi.org/10.1145/3359619.3359740.
  8. Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396-450, 2001. URL: https://doi.org/10.1145/503502.503505.
  9. Timothy Jones, Michael Homer, James Noble, and Kim Bruce. Object inheritance without classes. In Shriram Krishnamurthi and Benjamin S. Lerner, editors, ECOOP'16 - Object-Oriented Programming, volume 56, pages 13:1-13:26. Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 2016. URL: https://doi.org/10.4230/LIPIcs.ECOOP.2016.13.
  10. Davood Mazinanian, Ameya Ketkar, Nikolaos Tsantalis, and Danny Dig. Understanding the use of lambda expressions in Java. Proceedings of ACM on Programming Languages, 1(OOPSLA 2017):85:1-85:31, 2017. URL: https://doi.org/10.1145/3133909.
  11. Martin Plümicke. Well-typings for Java_λ. In Christian W. Probst and Christian Wimmer, editors, Principles and Practice of Programming in Java - PPPJ 2011, pages 91-100. ACM Press, 2011. URL: https://doi.org/10.1145/2093157.2093171.
  12. Yanlin Wang, Haoyuan Zhang, Bruno C. d. S. Oliveira, and Marco Servetto. Classless Java. In Bernd Fischer and Ina Schaefer, editors, Generative Programming: Concepts and Experiences - GPCE 2016, pages 14-24. ACM Press, 2016. URL: https://doi.org/10.1145/2993236.2993238.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail