Single Serving Values with Linear Types in Scala
summary
Linear types require values be used exactly once and the implementation here adds that check to Scala via a Scalafix lint called linear scala that marks types as a with Linear and counts dereferences at compile time. It turns runtime bugs—double-use of a stream, using a closed file handle, wrong monoid argument, or unnoticed shadowed variables—into compile errors, proving the idea on real examples; the prototype is a Scalafix rule and it works for these cases.
AI-written summary · about
chapters (13)
- 0:00Introduction to talk
- 0:46What are linear types
- 3:13Types progression and restrictions
- 8:38Linear types in Scala
- 15:46Linear Scala implementation
- 16:09First bug detection example
- 19:18Syntax improvements discussion
- 21:23Variable shadowing example
- 24:13For-comprehension shadowing
- 25:35Resource management bug
- 27:41Other linear type use cases
- 28:45Summary and benefits
- 30:10Q&A and resources
related talks
35mLiteral types what they are good for
24mLet the Scala compiler work for you
45mTypelevel Programming 101: The Subspace of Scala
49mType level Programming in Scala
39mA few tips on modelling things in Scala
31mMaking sense of initialization order in Scala
47mIdris For (Im)practical Scala Programmers
38mThinking Less with Scala
