News for hackers. Stuff that matters.
Re:JVM/Java: Null-Restricted and Nullable Types by simon_void on Friday August 02, 2024 @11:51AM (#41139878)
you failed to mention that Kotlin has platform types only if it's interoperates with Java. Platform types are for objects that come over from Java code (and therefore have unspecified nullability (assuming the Java code doesn't use nullability annotations)). Admittedly you provided a link that explains this, but how many people will follow the link? And yes, this detail feels kind of important. And yes, future Java (and Kotlin) will only have their version of platform types to interop with old Java code.

As a long-time Kotlin user I can only say: Nullability is nice! Once you know it, you won't want to code without it.

Re:JVM/Java: Null-Restricted and Nullable Types by unscaled on Friday August 02, 2024 @12:13PM (#41140066)
I did mention all of this:

"[...] but Kotlin still needs to support [platform types] to maintain compatibility with underlying platforms that support unspecified nullability, such as the JVM and JavaScript."

To be more accurate, "platform types" are not used with JavaScript, but you do get something similar in that case. I haven't worked with Kotlin/JS at all, but from my understanding if you do not have proper type definitions, you have to deal with dynamic types - which are also nullable.

Re:JVM/Java: Null-Restricted and Nullable Types by mmis1000 on Friday August 02, 2024 @12:06PM (#41139994)
The type kotlin generated from java code also inserts nullable specifier if java code have @NonNull or @Nullable specified.

When kotlin see these exist. It will convert the type to null enforced type instead. Which give you a tool to gradually convert you project to null enforced type if you can't convert it to kotlin at once.