License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2018.9
URN: urn:nbn:de:0030-drops-92145
URL: http://dagstuhl.sunsite.rwth-aachen.de/volltexte/2018/9214/
Bi, Xuan ;
Oliveira, Bruno C. d. S.
Typed First-Class Traits
Abstract
Many dynamically-typed languages (including JavaScript, Ruby, Python or Racket) support first-class classes, or related concepts such as first-class traits and/or mixins. In those languages classes are first-class values and, like any other values, they can be passed as an argument, or returned from a function. Furthermore first-class classes support dynamic inheritance: i.e. they can inherit from other classes at runtime, enabling programmers to abstract over the inheritance hierarchy. In contrast, type system limitations prevent most statically-typed languages from having first-class classes and dynamic inheritance.
This paper shows the design of SEDEL: a polymorphic statically-typed language with first-class traits, supporting dynamic inheritance as well as conventional OO features such as dynamic dispatching and abstract methods. To address the challenges of type-checking first-class traits, SEDEL employs a type system based on the recent work on disjoint intersection types and disjoint polymorphism. The novelty of SEDEL over core disjoint intersection calculi are source level features for practical OO programming, including first-class traits with dynamic inheritance, dynamic dispatching and abstract methods. Inspired by Cook and Palsberg's work on the denotational semantics for inheritance, we show how to design a source language that can be elaborated into Alpuim et al.'s F_{i} (a core polymorphic calculus with records supporting disjoint polymorphism). We illustrate the applicability of SEDEL with several example uses for first-class traits, and a case study that modularizes programming language interpreters using a highly modular form of visitors.
BibTeX - Entry
@InProceedings{bi_et_al:LIPIcs:2018:9214,
author = {Xuan Bi and Bruno C. d. S. Oliveira},
title = {{Typed First-Class Traits}},
booktitle = {32nd European Conference on Object-Oriented Programming (ECOOP 2018)},
pages = {9:1--9:28},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-079-8},
ISSN = {1868-8969},
year = {2018},
volume = {109},
editor = {Todd Millstein},
publisher = {Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik},
address = {Dagstuhl, Germany},
URL = {http://drops.dagstuhl.de/opus/volltexte/2018/9214},
URN = {urn:nbn:de:0030-drops-92145},
doi = {10.4230/LIPIcs.ECOOP.2018.9},
annote = {Keywords: traits, extensible designs}
}
Keywords: |
|
traits, extensible designs |
Collection: |
|
32nd European Conference on Object-Oriented Programming (ECOOP 2018) |
Issue Date: |
|
2018 |
Date of publication: |
|
10.07.2018 |
Supplementary Material: |
|
ECOOP Artifact Evaluation approved artifact available at http://dx.doi.org/10.4230/DARTS.4.3.9 |