All talks

Devoxx Greece 2025 - Kotlin DSL in under an hour

Devoxx 2025Apr 20250 views

Speaker

About this talk

Learn how to create type-safe and statically typed DSLs in Kotlin. In this session, you will learn about the language features that make DSL creation possible: - Top-level extension functions and properties - Trailing lambda expressions as function parameters - SAM type conversion - Functional literals with receiver - Infix functions - Standard library scope functions - Context parameters Step by step, using the features above, I will convert Java code based on the builder pattern into an internal Kotlin DSL. The talk highlights the specific cases for using the DSL approach in Kotlin and the tradeoffs for introducing this programming technique into the projects.