What are your strategies for exposing Kotlin DSLs ...
# getting-started
c
What are your strategies for exposing Kotlin DSLs for Java users? The explicit
return Unit.INSTANCE;
at the end of each lambda is quite versbose.
k
I just wouldn't recommend using Kotlin DSLs in Java, as Kotlin DSLs are meant to be used by Kotlin apps. If Java users really need the feature provided by a Kotlin DSL, I would write a Java-friendly wrapper API for it, to avoid such a clash of idioms.
c
There's not really a Java equivalent though. Builders exist, but they don't allow conditionals.