Welterweight Go: Boxing, Structural Subtyping, and Generics

Read full text
Authors: Raymond Hu, Julien Lange, Bernardo Toninho, Philip L. Wadler, Robert Griesemer, Keith H. Randall
Cited by: 0
References: 17

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.

Fields of Study & Subjects

Logic programming and type systems Artificial Intelligence in Games Model-Driven Software Engineering Techniques

Publication details

Journal / source
Proceedings of the ACM on Programming Languages
Volume
10
Issue
POPL
Pages
2295–2322
Publication date
8 January 2026
Language
EN