News for hackers. Stuff that matters.
Re:Why Haskell? by cubefox on Thursday September 12, 2024 @12:15PM (#41522478)
Types in old code may be nullable, or not, the compiler doesn't know, so the only way the compiler can ensure null safety for using old code is by enforcing you to do null checks everywhere. That's not very practical. Moreover, the old code itself may still produce null pointer exceptions.
Re:Why Haskell? by vips7L on Thursday September 12, 2024 @01:10PM (#41523084)
But that doesn't break compatibility like you claimed and it also doesn't support your conclusion that it will not likely be used.

> he compiler doesn't know, so the only way the compiler can ensure null safety for using old code is by enforcing you to do null checks everywhere

This isn't necessarily true. Java's approach is to have 3 types: nullable, non-null, and platform (just like Kotlin). Platform types are types without nullness markers and don't require strict null checks to prevent backwards compatibility breaking. Yes, old code may still product null pointers, but we don't need 100% correctness right away. At some point platform types will be 1% of code in the wild rather than 100%.

Re:Why Haskell? by cubefox on Thursday September 12, 2024 @04:08PM (#41524974)
> At some point platform types will be 1% of code in the wild rather than 100%.

In the case of Java this could take decades. Or people simply continue to write platform types because they are lazy (the compiler doesn't force them). Then platform types will never decrease substantially.

Re:Why Haskell? by vips7L on Thursday September 12, 2024 @05:10PM (#41525619)
I don't think that's true and I don't think there is any data to back that up. We've already seen in the C# community rapid adoption of nullness markers. This whole goal post moving and the idea that if we can't have 100% we shouldn't do it at all is a bit exhausting so I think I'm done here. Cheers man.
Re:Why Haskell? by valenterry on Thursday September 12, 2024 @03:17PM (#41524471)
Well yeah, there is no way around this on the JVM. That's one of the JVM's problems/drawbacks. Everything can be null and everything can throw exceptions.

But in practice, as long as you use only Scala libraries and are careful when using Java libraries it's not really an issue. (speaking as a professional Scala developer for many many years)