paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Structural Subtyping as Parametric Polymorphism

结构子类型作为参数多态
OOPSLA 7(OOPSLA2)2023匹配度 1/10 · 该论文研究结构子类型与参数多态的表达力,属于纯类型系统/形式语义理论,未涉及LLM、Agent、静态分析、浮点程序分析或贝叶斯程序分析,与用户研究画像的核心交叉方向无关。引用 3 inbox
Wenhao Tang, Daniel Hillerström, James McKinna, Michel Steuwer, Ornela Dardha, Rongxiao Fu, Sam Lindley
crossref: 2026-09-10

AI 速览

一句话:系统比较结构子类型与参数多态的表达力,证明完整子类型无法由多态编码,但若干受限子类型可以。

结构子类型与参数多态都能为程序员提供灵活性与可复用性,例如把更宽的记录传给期望更窄记录的函数;但二者实现方式不同,其精确关系此前多为民间知识。本文系统研究二者的相对表达力:以多种扩展记录与变体的 Church 风格 λ-演算为基础,考虑不同形式的结构子类型以及行多态和 presence 多态。作者通过给出演算间的组合式翻译来刻画表达力,并对每个翻译证明类型保持与操作对应。论文还证明若干不存在性结果:完整子类型不能通过多态编码,但若干受限形式的子类型可由特定形式的多态编码;对源与目标类型施加限制会揭示更细微的表达力图景。

问题
结构子类型与参数多态在提供灵活性和复用性上相似,但二者相对表达力的精确关系缺乏系统研究。论文要弄清参数多态(行多态与 presence 多态)能在多大程度上编码记录与变体的结构子类型。
方法
在多种带记录、变体、不同结构子类型以及行/presence 多态的 Church 风格 λ-演算中,构造演算间的组合式翻译,并证明类型保持与操作对应,同时给出若干不存在性结果。
评估
评估方式是理论证明:对每个翻译证明类型保持与操作对应,并通过非存在性结果界定不可编码的情形;再通过限制源与目标类型展示可编码的受限子类型。
原文摘要(Abstract)

Structural subtyping and parametric polymorphism provide similar flexibility and reusability to programmers. For example, both features enable the programmer to provide a wider record as an argument to a function that expects a narrower one. However, the means by which they do so differs substantially, and the precise details of the relationship between them exists, at best, as folklore in literature. In this paper, we systematically study the relative expressive power of structural subtyping and parametric polymorphism. We focus our investigation on establishing the extent to which parametric polymorphism, in the form of row and presence polymorphism, can encode structural subtyping for variant and record types. We base our study on various Church-style λ-calculi extended with records and variants, different forms of structural subtyping, and row and presence polymorphism. We characterise expressiveness by exhibiting compositional translations between calculi. For each translation we prove a type preservation and operational correspondence result. We also prove a number of non-existence results. By imposing restrictions on both source and target types, we reveal further subtleties in the expressiveness landscape, the restrictions enabling otherwise impossible translations to be defined. More specifically, we prove that full subtyping cannot be encoded via polymorphism, but we show that several restricted forms of subtyping can be encoded via particular forms of polymorphism.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1826,
  title = {Structural Subtyping as Parametric Polymorphism},
  author = {Wenhao Tang and Daniel Hillerström and James McKinna and Michel Steuwer and Ornela Dardha and Rongxiao Fu and Sam Lindley},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA2},
  year = {2023},
  doi = {10.1145/3622836}
}