Lune

OOPSLA2022Top-tier venue

Generic go to go: dictionary-passing, monomorphisation, and hybrid

Stephen Ellis, Shuofei Zhu, Nobuko Yoshida, Linhai Song

Abstract

Go is a popular statically-typed industrial programming language. To aid the type safe reuse of code, the recent Go release (Go 1.18) published early 2022 includes bounded parametric polymorphism via generic types. Go 1.18 implements generic types using a combination of monomorphisation and call-graph based dictionary-passing called hybrid. This hybrid approach can be viewed as an optimised form of monomorphisation that statically generates specialised methods and types based on possible instantiations. A monolithic dictionary supplements information lost during monomorphisation, and is structured according to the program’s call graph. Unfortunately, the hybrid approach still suffers from code bloat, poor compilation speed, and limited code coverage. In this paper we propose and formalise a new non-specialising call-site based dictionary-passing translation. Our call-site based translation creates individual dictionaries for each type parameter, with dictionary construction occurring in place of instantiation, overcoming the limitations of hybrid. We prove it correct using a novel and general bisimulation up to technique. To better understand how different generics translation approaches work in practice, we benchmark five translators, Go 1.18, two existing monomorphisation translators, our dictionary-passing translator, and an erasure translator. Our findings reveal several suggestions for improvements for Go 1.18— specifically how to overcome the expressiveness limitations of generic Go and improve compile time and compiled code size performance of Go 1.18.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Extending Isabelle/HOL's Code Generator with Support for the Go Programming Language cites Featherweight go
  • Welterweight Go: Boxing, Structural Subtyping, and Generics cites Featherweight go
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Extending Isabelle/HOL's Code Generator with Support for the Go Programming LanguageTerru Stübinger, Lars HupelFM 2024 · 1 citation
  2. Welterweight Go: Boxing, Structural Subtyping, and GenericsRaymond Hu, Julien Lange, Bernardo Toninho, Philip Wadler et al.POPL 2026

Builds on1

  1. Featherweight goRobert Griesemer, Raymond Hu, Wen Kokke, Julien Lange et al.OOPSLA 2020 · 16 citations

Related papers

  1. The Simple Essence of MonomorphizationMatthew Lutze, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025 · 2 citations
  2. Class-Dictionary Specialization with Rank-2 Polymorphic FunctionsYong Qi Foo, Michael D. AdamsOOPSLA 2026
  3. Measuring the Impact of Programming Language DistributionGabriel Orlanski, Kefan Xiao, Xavier Garcia, Jeffrey Hui et al.ICML 2023 · 49 citations
  4. Automated Verification of Go Programs via Bounded Model CheckingNicolas Dilley, Julien LangeASE 2021 · 21 citations
  5. Bounded Sort Polymorphism with Elimination ConstraintsJohann Rosain, Tomás Díaz, Kenji Maillard, Matthieu Sozeau et al.POPL 2026
Dusk over the sea between two cliffs drawn in fine vertical lines