Generic Arity: Definition-Checked Variadics in Carbon
summary
Carbon models variadics as definition-checked variadics by representing tuple/pack types as sequences of segments (an explicit repetition count plus an element type), adds pack expansion statements and an each name for per-element access, and performs compile-time rewrites that merge parameters or arguments so function-call typechecking stays linear instead of quadratic. The prototype lives on GitHub, supports homogeneous packs and mid-parameter packs, and accepts almost all real APIs; the algorithm is heuristic and falls back to template-style instantiation for contrived edge cases.
AI-written summary · about
chapters (8)
- 0:00Introduction to Carbon
- 2:35Function syntax in Carbon
- 7:41Generics and definition check
- 13:07Variadic function overview
- 22:42Type checking variadic patterns
- 31:25Iterative programming model
- 43:07Type system representation
- 59:35Efficient call type checking
related talks
01h 01mHow Designing Carbon C++ Interop Taught me About C++ Variadics & Bound Members
27mUnboxing Virgil ADTs For Fun and Profit
43m“Variadic expansion in examples"
53mC++ Variadic Templates and Parameter Packs
01h 23mCarbon Language: An experimental successor to C++
18mOn the Expressive Power of Languages for Static Variability
01h 10mBack to Basics: Algebraic Data Types
01h 08mType Arithmetic and the Yoneda Lemma
