Two seconds suggestion: allow referring to the parameter of a when
block via the implicit it
variable, just like in lambdas. Or failing that, allowing something like when (val x = ....) { ... }
.
One problem I see: in case of nested when
, it
is ambiguous (but you’re not worse off than you are today).
I’ll also use this topic to piggyback my question from this topic:
How to deal with nested “receivers functions”? e.g.
thing.apply { stuff.apply { /* how to refer to "thing" using "this" here? */ } }