I’m thinking about little DSL. I want to be able to write something like
x = any
// or
f(any)
where any
is some function which returns any type. I can write it as:
fun <T> any(): T { ... }
and use as
x = any()
// or
f(any())
but those parentheses are a little bit noisy.
I investigated Nothing
class. It seems that I can assign it to any value, so I could declare something like
val any: Nothing get() { ... }
and use it as I want, but Idea marks the code after it as unreachable and it seems to compile to something strange, so it’s not a good option either.