Going structural with Named Tuples
summary
Scala 3.6 stabilises Named Tuples which add compile‑time labels to tuples, letting code build schemas without macros using the mirror framework, match types, inline ops and compiletime literal-to-value conversion. Demos convert case classes to labeled tuples, generate JSON with upickle, drive a Spark‑style DataFrame aggregation, and run a full‑stack Laminar CRUD app with typed fetch endpoints backed by a log‑based DB — all working live. Key limits: no recursion in literal named tuples and opaque typing blocks some match‑type introspection.
AI-written summary · about
chapters (12)
- 0:00Named tuples in Scala 3
- 1:08Why named tuples introduced
- 2:52Structural typing problems
- 9:37Named tuple syntax
- 11:25Named vs structural types
- 13:59Operations and derivation
- 16:23Structural type improvements
- 17:28Demos and examples
- 25:25Tools for named tuples
- 26:11Named tuple limitations
- 29:21Recursive and match types
- 30:04Conclusion
related talks
24mNamedTuples in Action
35mLiteral types what they are good for
43mIt quacks but it’s not a duck structural typing in Scala 3
49mType level Programming in Scala
43mEffective Match Types
24mLet the Scala compiler work for you
51mOpening Keynote: New Functional Constructs in Scala 3
42mPolymorphic Function Types in Scala 3
