~/talk

Advanced techniques for building Kotlin DSL(s)

links:none on file
slides:none on file

Shows how to implement a Kotlin DSL that generates Starlark (Bazel) code by building an AST of typed nodes and emitting formatted files, used in Project Iron for Gradle→Bazel migration. Uses lambda with receiver entry points, extension and backticked operator functions to mimic index/assignment/plus/slice syntax, DSL markers and per-feature interfaces to avoid context leaks, and KSP to auto-generate boilerplate for functions with ~10–15 arguments. Produces real Starlark output and is applied successfully in the migration project.

AI-written summary · about

  1. 0:00Introduction to Kotlin DSLs
  2. 6:31Entering DSL context in Kotlin
  3. 9:41Implementing indexed access operators
  4. 11:05Using property delegation for assignments
  5. 14:33Dynamic function arguments
  6. 17:01Custom function calls with lambdas
  7. 18:27Handling concatenation operations
  8. 20:52Preventing context conflicts with DSL markers
  9. 21:58Structuring DSL with feature interfaces
  10. 24:07Additional DSL features like list comprehensions
  11. 25:54Automating DSL generation with KSP
  12. 27:40Real-world DSL example in Android projects
  13. 30:10Key takeaways and experimentation
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.