paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Welterweight Go: Boxing, Structural Subtyping, and Generics

Welterweight Go:装箱、结构子类型与泛型
POPL 10(POPL)2026匹配度 1/10 · 论文聚焦 Go 语言核心演算、泛型与结构子类型,以及类型导向编译和运行时表示,属于 PL/类型系统与编译方向;但完全不涉及 LLM/Agent、将静态分析应用于 ML 系统或 Agentic 程序、浮点程序分析、贝叶斯程序分析等用户核心研究方向,因此匹配度很低。引用 0 inbox
Raymond Hu, Julien Lange, Bernardo Toninho, Philip Wadler, Robert Griesemer, Keith Randall
crossref: 2026-09-10

AI 速览

一句话:提出 Go 核心模型 WG 与运行时低级语言 LWG,给出兼顾结构子类型与泛型的类型导向编译方案。

Go 将泛型与类型之间的结构子类型同非一致的运行时表示相结合,使其形式化面临显著挑战,而既有工作遗漏了底层类型(underlying types)、类型并集与类型集、以及泛型方法等关键特性。本文提出 WG(Welterweight Go),一个刻画这些特性的 Go 核心模型;并设计低级语言 LWG,建模 Go 的运行时机制,尤其是原始结构体值与携带运行时类型信息(RTTI)的接口值之间的区分。作者给出从 WG 到 LWG 的类型导向编译,说明这些新特性可以被实现,同时满足 Go 的重要设计与实现目标:兼容分离编译、不在运行时生成代码。与基于静态单态化的既有方法不同,该编译策略使用运行时类型转换与适配器方法来处理结构子类型、泛型与运行时基础设施之间的复杂交互。

问题
Go 将泛型与类型间的结构子类型、非一致的运行时表示结合在一起,难以形式化;既有工作未覆盖底层类型、类型并集与类型集以及泛型方法等特性。
方法
提出核心演算 WG 与低级语言 LWG(区分原始结构体值与携带 RTTI 的接口值),并给出从 WG 到 LWG 的类型导向编译。
评估
通过该编译策略(采用运行时类型转换与适配器方法而非静态单态化)论证所提特性可实现,并保持分离编译兼容与无运行时代码生成这两个设计目标。
原文摘要(Abstract)

Go’s unique combination of structural subtyping between generics and types with non-uniform runtime representations presents significant challenges for formalising the language. We introduce WG (Welterweight Go), a core model of Go that captures key features excluded by prior work, including underlying types, type unions and type sets, and proposed new features, such as generic methods. We also develop LWG, a lower-level language that models Go’s runtime mechanisms, notably the distinction between raw struct values and interface values that carry runtime type information (RTTI). We give a type-directed compilation from WG to LWG that demonstrates how the proposed features can be implemented while observing important design and implementation goals for Go: compatibility with separate compilation, and no runtime code generation. Unlike existing approaches based on static monomorphisation, our compilation strategy uses runtime type conversions and adaptor methods to handle the complex interactions between structural subtyping, generics, and Go’s runtime infrastructure.

链接与引用

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

BibTeX
@article{paperbot3853,
  title = {Welterweight Go: Boxing, Structural Subtyping, and Generics},
  author = {Raymond Hu and Julien Lange and Bernardo Toninho and Philip Wadler and Robert Griesemer and Keith Randall},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {POPL},
  year = {2026},
  doi = {10.1145/3776721}
}