pablisco
07/28/2020, 9:57 AMpedro
07/28/2020, 10:53 AMinterface ApiStep1 {
fun configureA(value: String): ApiStep2
}
interface ApiStep2 {
fun configureB(value: String): ApiStep3
}
interface ApiStep3 {
// ... all other things you'd like to expose in the DSL
}
Consuming it (not in a DSL):
someBuilder()
.configureA("Hello")
.configureB("World")
.yadaYada()
.build()
Dominaezzz
07/28/2020, 11:24 AMpablisco
07/28/2020, 11:27 AMcallbackFlow {
// do something
onCancel {
}
// if anything is called after onCancel then we throw a compiler error
onCancel {
// this block would give a compilation error
}
}
pablisco
07/28/2020, 11:28 AMDominaezzz
07/28/2020, 11:29 AMpedro
07/28/2020, 11:54 AMcallbackFlow {
// do something
} onCancel {
}
where onCancel
is just an infix function. Although you probably don’t want to change the callbackFlow API but this could work if that was just an example. On the other hand, this syntax is a bit weird and is a lot more limited than what you asked originally… Hoping maybe we can iterate it further 😬pablisco
07/28/2020, 12:23 PMraulraja
07/28/2020, 4:06 PMraulraja
07/28/2020, 4:07 PMraulraja
07/28/2020, 4:07 PMdmitriy.novozhilov
07/28/2020, 5:03 PMdmitriy.novozhilov
07/28/2020, 5:04 PMdmitriy.novozhilov
07/28/2020, 5:05 PMpablisco
07/28/2020, 6:27 PMdmitriy.novozhilov
07/28/2020, 6:30 PMelizarov
07/29/2020, 9:41 AMpablisco
07/29/2020, 9:47 AMNick Johnson
07/30/2020, 11:59 PM