4 ms·
Kotlin does that with it's smart cast feature: https://kotlinlang.org/docs/reference/typecasts.html https://kotlinlang.org/docs/reference/typecasts.html It's r
by greiskul 9y ago
Kotlin does that with it's smart cast feature: https://kotlinlang.org/docs/reference/typecasts.html https://kotlinlang.org/docs/reference/typecasts.html
It's really great actually, and the IDE also helps by marking foo slightly different inside the block, and if you mouseover to check for it's type it says what it is, and that it's because of a smart cast.
- hinkley 9y agoI have a suspicion that the Jetbrains guys were reading the same language design sources that I was. There are several other features like the ? operator that I saw in a small language first (called Nice). Daniel Bonnoit did a good job of articulating some of his design choices, especially optional types.