3 ms·
That “instanceof” change looks strictly worse than Kotlin’s “smart casts” (after checking x is an instance of Y, x implicitly casts to Y as long as its value do
by iainmerrick 7y ago
That “instanceof” change looks strictly worse than Kotlin’s “smart casts” (after checking x is an instance of Y, x implicitly casts to Y as long as its value doesn’t change).
The new Java shorthand, by introducing a new variable name, also introduces some sneaky variable shadowing risks (as this blog post itself explains!)
Edit to add: maybe the difficulty is in formally specifying “smart casts”, or at least clearly documenting them? I don’t think Jetbrains has documented all the rules used by Kotlin. It doesn’t seem undoable, though.