3 ms·
Has nobody done this before Kotlin? Most languages including Java and C++ have “non-null” and “nullable” annotations. These types work exactly like Kotlin’s af
by armchairhacker 4y ago
Has nobody done this before Kotlin?
Most languages including Java and C++ have “non-null” and “nullable” annotations. These types work exactly like Kotlin’s afaik, where if they’re not specified the compiler is flexible and assumes whatever works.
In fact Swift and C# seem to have this same feature or at least something similar. And I know C# added it way before Kotlin.
- mrkeen 4y ago> Most languages including Java and C++ have “non-null” and “nullable” annotations I thought this too until I gave them a try 6 or 7 years ago. And nope, it was just advisory in the Java case. May as well have been a comment. At best, it's shorthand for: throw a runtime exception if-and-only-if this method was called (directly) by Spring-or-similar. What would a variable marked with Nullable mean anyway? That the other variables are not nullable?