Play on Dotty: Design Patterns unlocked by Dotty in a Play...
summary
Dotty (Scala 3, using 0.10.0‑RC1 with SBT 1.2.3) unlocks implicit functions and trait parameters to thread request context without thread‑locals. A Play‑like strawman is built: action builders that refine a base request into a correlation‑ID and optional authenticated user, a context refiner abstraction, and a logger that injects path/user/correlation into logs. The demo runs end‑to‑end (200/401 flows), compares reader‑monad, explicit funcs and implicits, and the code is on GitHub.
AI-written summary · about
chapters (21)
- 0:00Introduction to speaker
- 0:14Scala and Play framework journey
- 2:20What is Dotty and Scala 3
- 4:06Understanding context in applications
- 7:17Modules and dependency injection
- 10:28Parameterizing context passing
- 13:17Reader monad for context
- 17:34Implicit parameters in Scala
- 19:03Implicit functions in Scala 3
- 21:11Demo goals and setup
- 22:37Simple Play action builder demo
- 25:38Accessing request context in Play
- 27:05Custom request context refinement
- 28:32Context refiners explained
- 30:17Refining action builders
- 31:22Authenticated request context
- 33:38Custom responders for responses
- 35:29Context-based logging demo
- 37:55Advantages over thread locals
- 38:16Library design with context
- 39:07Closing remarks and thanks








