Kotlin for Internal DSLs
Kotlin is a wonderful language for creating internal DSLs. Static typing generally poses some strong limitations on a language’s ability to serve as a host for internal DSLs. Surprisingly, though, some of Kotlin’s unique capabilities not found in other statically typed languages push the limits to make creating internal DSLs not only possible but a pleasant experience as well. Let’s quickly review some of the capabilities of Kotlin that will serve as your allies when designing DSLs.
Optional Semicolon
Kotlin doesn’t insist on semicolons—see Semicolon Is Optional. That’s a clear benefit for fluency. A semicolon disrupts flow and is noise in a lot of situations. Not having to use it is especially critical for creating ...
Get Programming Kotlin now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.