Lightweight Family Polymorphism


Chieri Saito, Atsushi Igarashi, Mirko Viroli

Journal of Functional Programming 18(3), pages 285-331
May 2008

Family polymorphism has been proposed for object-oriented languages as a solution to supporting reusable yet type-safe mutually recursive classes. A key idea of family polymorphism is the notion of families, which are used to group mutually recursive classes. In the original proposal, due to the design decision that families are represented by objects, dependent types had to be introduced, resulting in a rather complex type system. In this article, we propose a simpler solution of lightweight family polymorphism, based on the idea that families are represented by classes rather than by objects. This change makes the type system significantly simpler without losing much expressive power of the language. Moreover, "family-polymorphic" methods now take a form of parametric methods; thus, it is easy to apply method type argument inference as in Java 5.0. To rigorously show that our approach is safe, we formalize the set of language features on top of Featherweight Java and prove that the type system is sound. An algorithm for type inference for family-polymorphic method invocations is also formalized and proved to be correct. Finally, a formal translation by erasure to Featherweight Java is presented; it is proved to preserve typing and execution results, showing that our new language features can be implemented in Java by simply extending the compiler.

(keywords) inheritance, family polymorphism, Featherweight Java

Tags:

Publications

Publications / Views

Home

Clouds
•  tags  •  authors  •  editors  •  journals  

Year
 2023    2022    2021    2020    2019    2018    2017    2016    2015    2014–1927

Sort
•  in journal  •  in proc  •  chapters  •  books  •  edited  •  spec issues  •  editorials  •  entries  •  manuals  •  tech reps  •  phd th  •  others  

Status
•  online  •  in press  •  proof  •  camera-ready  •  revised  •  accepted  •  revision  •  submitted  •  draft  •  note  

Services
•  ACM Digital Library  •  DBLP  •  IEEE Xplore  •  IRIS  •  PubMed  •  Google Scholar  •  Scopus  •  Semantic Scholar  •  Web of Science  •  DOI  

Publication

— authors

Chieri Saito, Atsushi Igarashi, Mirko Viroli

— status

published

— sort

article in journal

— publication date

May 2008

— journal

Journal of Functional Programming

— volume

18

— issue

3

— pages

285-331

URLs

original page

identifiers

— DOI

10.1017/S0956796807006405

— print ISSN

0956-7968

— online ISSN

1469-7653

notes

— note

A preliminary summary appeared in the proceedings of the third Asian Symposium on Programming Languages and Systems (APLAS2005), volume 3780 of Lecture  Notes in Computer Science, Tsukuba, Japan, November 2005, Springer-Verlag, pp. 161?177.

Partita IVA: 01131710376 — Copyright © 2008–2023 APICe@DISI – PRIVACY