https://kotlinlang.org logo
#dsl
Title
# dsl
c

ciscorucinski

11/08/2020, 6:13 AM
I am fairly new with Kotlin, but I am interested in building a potential DSL. Most of the talks I have seen with creating DSL focus on transforming existing code to a DSL structure, but I am looking at starting from scratch with no existing code. Are there some good talks focused on that and how to start a dsl from scratch?
s

Shawn

11/08/2020, 4:24 PM
I actually asked a pretty similar question a while ago, here’s the thread: https://kotlinlang.slack.com/archives/C8NEU7N9L/p1567706298001900
a year later I’d say that those talks weren’t really for me, but I’d probably tell you just not to overthink it. Just start prototyping what you think you want your DSL to look like and wire it up with the necessary functions and data classes. You’ll discover things you like and dislike about your initial design and be able to use the fundamentals covered in the talks to iterate and improve things you think are awkward or unnecessary
👍 1
additionally, though this isn’t a talk, I think the kotlinx.html DSL was a great help for me to see how all sorts of neat language tricks were implemented
m

Matteo Mirk

11/09/2020, 10:07 AM
This is a great talk where Venkat creates example DSLs from scratch

https://www.youtube.com/watch?v=JzTeAM8N1-o

👍 2
w

wakingrufus

11/09/2020, 2:44 PM
I can share an example. I have a cooking recipe DSL I have been working on, and it looks like this: https://github.com/wakingrufus/website/tree/master/recipe-dsl/src/main/kotlin/com/github/wakingrufus/recipe and the usage is: https://github.com/wakingrufus/website/blob/master/personal-site/src/main/kotlin/com/github/wakingrufus/website/cooking/RecipeIndex.kt It could use some work, but it should give you some ideas
👍 1
4 Views