~/talk

Everything You Always Wanted to Know About Type Inference

Talkat GopherCon 2023 · 2023-09-26..09-29· [compilers-and-language-design, go]
slides:none on file

Explains how Go 1.21 improves type inference by reducing generic boilerplate and solving type equations via unification of type equations across multiple function calls, with concrete examples (maps-of-structs that unify type parameters, failure cases when structures differ). Describes fixes for untyped-constant defaults (choose later default for numeric mixes), renaming trick to handle self-recursive generic calls, and current limits: no inference for type instantiations of generic types and unresolved cyclic type-parameter cases.

AI-written summary · about

  1. 0:00Introduction
  2. 0:28Type inference in Go
  3. 3:42Notation and symbols
  4. 4:43Generic type pattern matching
  5. 7:38Type equations solving
  6. 13:59Bound versus free parameters
  7. 15:44Unification algorithm
  8. 17:07Recursive type comparison
  9. 20:39Unification for assignability
  10. 22:27Simplifications in unification
  11. 23:51Underlying type matching
  12. 25:16Constraint simplifications
  13. 26:39Untyped constants inference
  14. 29:54Inference order special cases
  15. 32:27Unnamed to named types
  16. 34:15Self-recursive types
  17. 36:43Limitations of inference
  18. 37:47When inference fails
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.