4 ms·
In my opinion the only critically missing feature in Java that Kotlin has are nullable types. It’s been proposed, but is stuck behind Valhalla. Kotlin has a lo
by vips7L 2y ago
In my opinion the only critically missing feature in Java that Kotlin has are nullable types. It’s been proposed, but is stuck behind Valhalla.
Kotlin has a lot of other smaller features that help with conciseness. Like single line methods, but it’s still missing critical features like checked errors.
Pick your poison.
- foolfoolz 2y agojava is on a great trajectory now. it gets big updates. they know where they are missing on features. even without nullable types you have optional. it’s a great language for any project.
- vips7L 2y agoOptional is not good at all. It is not enforced by the compiler and optional itself can be null. In hot loops it can allocate like crazy. We need compiler support to enforce nullability and to get null into the type system.
- samus 2y agoIn a codebase heavily reliant on Optional it can be worthwhile to install NullAway just for the benefit of banishing that particular source of null. That doesn't help with dependencies of course (unless you are certain they also use a nullability checker), and calls to those will have to be wrapped with your favorite `null -> Optional.empty()` helper function. The pain with allocation is temporary. It is one of the candidates to become value types.
- kasperni 2y ago> It’s been proposed, but is stuck behind Valhalla. It is actually a central part of Valhalla now [1]. [1] https://openjdk.org/projects/valhalla/ https://openjdk.org/projects/valhalla/
- vips7L 2y agoYes that qualifies as "stuck behind valhalla" for me. Valhalla... truly is Valhalla. Will we ever see it?
- deleted 2y ago[deleted]
- samus 2y agoThe name is quite tongue-in-cheek it seems. But when we reach it it will be glorious. Pieces of it are landing. Flexible constructor bodies will be finalized. Generics over primitive types might become part of Java 25. https://openjdk.org/jeps/218 https://openjdk.org/jeps/218
- vips7L 2y agoYeah I'm hopeful for a post-valhalla future now that things are slowly rolling in. There's a lot of stuff that Brian has proposed but has been put on hold!