DEV Community

Discussion on: Write DSLs and Code Faster

Collapse
 
prestongarno profile image
Preston • Edited

Kotlin has full support for type-safe DSLs from native code, they're easy to write combining applicatives with infix notation:

schemaProvider { kdelegateContext ->
  newBuilder<T>().withArgs<A>() takingArguments ::Always resultingIn { (args, builder) ->
     EnumAdapterImpl(clazz, args, builder.default).toDelegate(kdelegateContext)
  }
}.withAlternate { it allowing Nothing::class }
Collapse
 
barryosull profile image
Barry O Sullivan

I'll need to look into Kotlin, it looks quite concise, though it's not a syntax style I'm used to.