We show that a minimal subset of Java 8 excluding classes supports a simple and natural programming style, which we call lambda-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 lambda-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-lambda, an FJ variant including lambdas and interfaces with default methods, to FJ-lambda-, a subset of FJ-lambda with no classes (hence no constructors and fields). We provide several examples illustrating this novel programming style.

Lambda-based object-oriented programming

Zucca E.
2021-01-01

Abstract

We show that a minimal subset of Java 8 excluding classes supports a simple and natural programming style, which we call lambda-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 lambda-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-lambda, an FJ variant including lambdas and interfaces with default methods, to FJ-lambda-, a subset of FJ-lambda with no classes (hence no constructors and fields). We provide several examples illustrating this novel programming style.
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11567/1071166
 Attenzione

Attenzione! I dati visualizzati non sono stati sottoposti a validazione da parte dell'ateneo

Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 0
  • ???jsp.display-item.citation.isi??? ND
social impact