~/talk

Labeled Tuples (Informed Position)

Talkat ML 2024 · on Friday, 2024-09-06
links:none on file
name:Ryan Tjoa
links:none on file
slides:none on file

Adds labels to tuple fields, implemented as an optional label on every field and landed in Jane Street’s OCaml branch, with a small compiler change (no row polymorphism). Patterns support partial extraction and reordering only when the compiler knows the tuple type. Labels incur no runtime cost unlike polymorphic-variant or object hacks. Duplicate and omitted labels are allowed; projection is not added yet. The feature proves popular and is used in thousands of files across the codebase.

AI-written summary · about

  1. 0:00Introduction
  2. 1:19Labeled tuples in OCaml
  3. 2:42Label syntax and types
  4. 3:24Partial pattern matching
  5. 4:26Optional and repeated labels
  6. 5:49Adding label tuples
  7. 7:12Code without label tuples
  8. 9:16Alternatives to labels
  9. 11:21Design and implementation
  10. 13:24Popularity of labels
  11. 14:06Comparison with SML Flex records
  12. 15:29Labels vs records
  13. 16:12History of Flex records
  14. 17:15Future extensions
  15. 19:10Q&A: Design and optional params
  16. 20:13Q&A: Recursive types
  17. 20:54Q&A: Repeated labels issue
  18. 21:37Q&A: Scala’s similar feature
  19. 22:22Q&A: No Labels flag
  20. 22:44Q&A: Pattern matching order
  21. 23:48Q&A: Runtime efficiency
~/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.