How to avoid safety hazards when using closures in Scala
summary
A Scala 3 library called spores3 implements closures with explicit, typed environments, using macros for compile-time capture checking and type-class based portable serialization (serializes a builder id plus environment, not code). It enforces that captured vars aren’t referenced, statically requires serializers or a thread-safe type-class for the environment, supports micro-pickle integration, runs on JVM and Scala.js today, and exists as a pre-release (0.1.0) so the design and checks are implemented and usable now.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 2:42What is a closure
- 8:02Safety hazards with closures
- 16:55Remedies for closure issues
- 20:09Introducing spores 3
- 37:16Serialization in spores 3
- 38:20Implementation details
- 44:40Current status and plans
- 45:43Summary and advice
- 47:06Q&A session
related talks
44mSpores: Distributable Functions in Scala
01h 03mWhere Are We With Scala's Capabilities?
01h 01mTypesafe Scala, Typelevel Scala – What’s Going On, Anyway?
38mCapture Checking - A New Approach to Effect Safety in Scala
41mWhere Are We With Scala's Capabilities?
42mAvoiding macros with inline and derived
17mHerding types with Scala macros
52mWhat's coming in Scala 3
