Implementing a Macro
summary
A working string-interpolator macro and companion extractor for a tiny JSON DSL that compiles the literal parts plus the inline arguments into a runtime JSON value and into a schema used to produce refinement types for object fields and array element types. Implementation uses inline methods, quotes/splices, Selectable/selectDynamic, transparent macros and reflection to inspect argument types; it emits errors with precise source offsets mapped into the original string part. Code and slides live on GitHub.
AI-written summary · about
chapters (13)
- 0:00Macro implementation intro
- 1:10JSON DSL design
- 3:37Scala Selectable access
- 4:20String interpolator basics
- 7:32Macro implementation details
- 9:18String context parsing
- 13:33JSON extractor
- 15:19Metaprogramming patterns
- 19:13Refining types with macros
- 22:50Transparent macros types
- 24:40Schema generation
- 31:28Error reporting in macros
- 35:07Q&A








