miha-x64
02/27/2018, 8:36 PMsuspend Function<R>? Exactly Function because I don't know yet how many arguments it will accept.
Use-case: hierarchical web routing.
interface Address<T, HANDLER : suspend Function1<Unit>>
class Address1<T> : Address<T, suspend (T) -> Unit> handles /{a}/ addresses, fetches an object with a path, supplies fetched object to handler
class Address2<T, U> : Address<U, suspend (T, U) -> Unit> handles /{a}/{b}/ addresses, fetches T bound to a path, fetches its child U bound to b path, supplies them to handler
and so on...