Hi
I attended the UGM in Munich yesterday, talking with Eugene later about a problem I can’t solve. He suggested to post it, maybe you have an idea…
For simplicity and readability I would like to get rid of the generic in the alias. But uncommenting the doThat does not compile.
fun main(args: Array<String>)
{
val demo = Demo<String>()
demo doThis { say("generic alias") }
// demo doThat { say("simpler alias") }
}
typealias genericContext<T> = Demo<T>.() -> Unit
typealias simplerContext = Demo<*>.() -> Unit
class Demo<T>
{
infix fun doThis(block: genericContext<T>) = block()
infix fun doThat(block: simplerContext ) = block()
fun say(obj: T) = println(obj.toString())
}