‹Programming› 2022
Mon 11 - Thu 14 April 2022
Mon 11 Apr 2022 06:15 - 06:40 at Virtual Space - ‹Programming› Online Monday Chair(s): Jonathan Edwards

Many object-oriented dynamic languages allow programmers to extract methods from objects and treat them as functions. This allows for flexible programming patterns, but presents challenges for type systems. In particular, a simple treatment of method extraction would require methods to be contravariant in the receiver type, making overriding all-but-impossible. We present a detailed investigation of this problem, as well as an implemented and evaluated solution.

Method extraction is a feature of many dynamically-typed and gradually-typed languages, ranging from Python and PHP to Flow and TypeScript. In these languages, the underlying representation of objects as records of procedures can be accessed, and the procedures that implement methods can be reified as functions that can be called independently. In many of these languages, the programmer can then explicitly specify the this value to be used when the method implementation is called.

Unfortunately, as we show, existing gradual type systems such as TypeScript and Flow are unsound in the presence of method extraction. The problem for typing any such system is that the flexibility it allows must be tamed by requiring a connection between the object the method was extracted from, and the function value that is later called.

In Racket, where a method extraction-like facility, dubbed “structure type properties”, is fundamental to classes, generic methods, and other APIs, these same challenges arise, and must be solved to support this feature in Typed Racket. We show how to combine two existing type system features—existential types and occurrence typing—to produce a sound approach to typing method extraction.

We formalize our design, extending an existing formal model of the Typed Racket type system, and prove that our extension is sound. Our design is also implemented in the released version of Racket, and is compatible with all existing Typed Racket packages, many of which already used a previous version of this feature.

Mon 11 Apr

Displayed time zone: Lisbon change

06:00 - 09:00
‹Programming› Online Monday / Research Papers at Virtual Space
Chair(s): Jonathan Edwards
06:00
15m
Other
Conference Opening
G: Ademar Aguiar FEUP, Universidade do Porto, A: Emma Söderberg Lund University, S: Guido Salvaneschi University of St. Gallen
06:15
25m
Research paper
Type Checking Extracted MethodsVol. 6
Research Papers
Yuquan FU , Sam Tobin-Hochstadt Indiana University
Link to publication
06:40
25m
Research paper
Types for Tables: A Language Design BenchmarkEditors’ AwardVol. 6
Research Papers
Kuang-Chen Lu Brown University, USA, Ben Greenman Brown University, Shriram Krishnamurthi Brown University, United States
Link to publication
07:05
25m
Research paper
Continuation-Passing Style, Defunctionalization, Accumulations, and AssociativityReviewers’ AwardVol. 6
Research Papers
Jeremy Gibbons Department of Computer Science, University of Oxford
Link to publication
07:30
25m
Research paper
The Art of the Meta Stream Protocol: Torrents of StreamsVol. 6
Research Papers
Christophe De Troyer Vrije Universiteit Brussel, Jens Nicolay Vrije Universiteit Brussel, Wolfgang De Meuter Vrije Universiteit Brussel
Link to publication