From Zero to Three - Building a User Friendly DSL with Scala 3
summary
A domain-specific language for multiparty computation at Inpher is implemented as an embedded, two-stage DSL in Scala 3 using top-level functions to bootstrap user code, context functions to inject execution and MPC contexts, and hygienic Scala 3 macros (inline + quotes/splices) to detect external inputs and produce staged ASTs. The team trades some compile-time type safety for clearer staged error messages, uses Mill and Metals/VS Code, fixes minor Dotty bugs, ports macro-heavy deps, and reports the approach as practical and working.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 0:38Welcome
- 1:08Background
- 3:35Context
- 4:53Why Scala 3
- 5:36External DSL
- 6:15Goals
- 7:38Approach
- 8:28Example
- 10:21Structure
- 13:16Top Level Functions
- 14:42Implicit Parameters
- 16:54Implicit Functions for Debugging
- 18:02Context Functions for Debugging
- 19:25High Level Language
- 20:43MultiParty Block
- 22:14Implicit Not Found
- 25:39Macros Overview
- 26:49Expanded Macros
- 27:34Whitebox Macros
- 28:54Example repo
- 29:06Alternative approaches
- 31:03What were the challenges
- 33:18Lack of documentation
related talks
41mTeaching Domain Specific Languages in Scala
45mDesign and Effectiveness of Internal DSLs in Scala
49mTen Cool Things You Can Do With Scala 3
41mReconstructing Scala
48mMetaprogramming in Dotty
01h 04mOpening Keynote: Preparing for Scala 3
53mTaming the context beast
30mLessons Learned from 15 Years of Scala in the Wild
