Kotlin DSL in under an hour
summary
Live coding shows a real Kotlin DSL built atop existing Java classes: Java Consumer becomes a Kotlin lambda, builders turn into nested createClient/create blocks using lambdas with receiver, extension functions and extension properties, and apply to run builders. A custom DSL marker annotation enforces non‑interleaving at compile time and IDE completion surfaces DSL methods. The demo compiles and runs, the extraction into a reusable library is demonstrated, and the resulting scripts are shorter and idiomatic Kotlin.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 2:47Examples
- 6:17Entry point
- 7:13Example
- 18:39Functional interface
- 22:37lambda with receiver
- 29:34library
- 30:00API
- 30:27Design Approach
- 30:54If
- 31:30Invalid
- 33:48Compiler error
- 34:25Bonus
- 35:45Creating a client
- 36:14Creating a local date
- 37:04Adding an extension function on an integer








