Scala 3, Type Inference and You!
summary
Scala 3 (Dotty) changes when type variables get instantiated: it delays instantiation when a type parameter appears invariant or contravariantly, chooses lower bounds for covariant positions, and instantiates only type variables constrained before implicit search to support functional dependencies (matrix×vector→vector example). It removes Scala 2’s eager-per-parameter instantiation and the ad-hoc Nothing special-case, fixing lambda and new Foo() inference bugs (foldLeft accumulator and Array/Nothing cases). The implementation is exercised via a contributors thread and compatibility tests. instantiate constrained variables only instantiation on variance
AI-written summary · about
chapters (7)
- 0:00Scala 3 and type inference
- 2:24Compilers and typed trees
- 7:46Type parameter inference
- 19:41Scala 3 vs Scala 2 inference
- 25:28Advanced inference topics
- 39:12Union types challenges
- 44:39Q&A
related talks
30mDotty and types: the story so far
38mThinking in Scala 3 Types
51mOpening Keynote: New Functional Constructs in Scala 3
32mUnderstanding the Type System of Scala 3
38mType Parameter Power-Up! Variance, Bounds, and Inference
52mWhat's coming in Scala 3
49mTen Cool Things You Can Do With Scala 3
31mType-Classes (in Scala 3)
