4 ms·
And (non)nullable types even get in my way! Interesting how that goes...: the sibling comment to yours said the exact opposite. How does this feature get in yo
by sverhagen 7y ago
And (non)nullable types even get in my way!
Interesting how that goes...: the sibling comment to yours said the exact opposite. How does this feature get in your way?
- vbezhenar 7y ago1. Language problem: if (this.prop != null) { this.prop.something() // does not work } this construction works for local variables, but not for properties. Yeah, theoretically it could be modified by another thread or function in the middle. In practice it does not happen and I'm forced to use terrible code like this.prop?.apply { prop -> prop.something() } (this example could be written as this.prop?.something() but that's not the point, usually it's harder than that. 2. Interoperation problem. A lot of Java code does not use @Nullable annotations, so all types are just that: platform types. So Kotlin nullability adds nothing to that.