I’ve been working on <#C3PDK05DM|kweb> creating fa...
# announcements
i
I’ve been working on #kweb creating fairly complex DSLs for HTML, DOM manipulation, and even an interface to a material design light javascript library. For now I’ve been using .apply() to get something similar to the receiver pattern used for kotlinx.html. However I’m finding that, even using the DSL I created myself, I continuously have to refer to examples, rather than being able to take advantage of auto-completion to guide me. The reason is that as I nest receivers, I get a proliferation of possible receivers, and auto-complete becomes a lot less useful. More dangerously, it’s very easy to inadvertently use a function on one of the outer receivers rather than the inner-most block, leading to unexpected behavior that can be tricky to debug. I’m wondering if anyone else has given this some thought, and perhaps if there is a better pattern for creating DSLs in Kotlin?