I have a function that compiles in Kotlin 1.0.0 Beta if I write it like this {code} fun operation(int:Int) = when (int) { 0-> { val f = fun Int.() :Boolean { return true} f } 1-> { val f = fun Int.() :Boolean { return true} f } else -> throw Exception("gah") } {code}
Is there no way to make it work like this :
{code}
fun operation(int:Int) = when (int) {
0-> fun Int.() :Boolean { return true}
1-> fun Int.() :Boolean { return true}
else -> throw Exception(“gah”)
}
{code}
If I write that, I get all kinds of error like …you have to name function (name an anonymous function ? seriously ?), …
I get that it’s related to extension functions expression/litteral but this feels really dirty and unkotlin