News for hackers. Stuff that matters.
Re:JVM/Java: Null-Restricted and Nullable Types by noelwelsh on Friday August 02, 2024 @05:21AM (#41137279)
I think we're still in the bashing rocks together stage of programming, but things like this definitely make me smile. Java is not an innovative language and the fact it is evolving towards something better shows that the industry as a whole is moving forward. We can't be more than a decade away from everyone being able to program in a language with the features of ML circa 1983.
Re:JVM/Java: Null-Restricted and Nullable Types by pas on Friday August 02, 2024 @06:05AM (#41137491)
Scala is doing fine. ;P

There's a huge inertia to "strictly wrong, but already existing", so there is a bias to keep maintaining those things.

(And there are - at least - hundreds of thousands of programmers with huge status quo biases. We saw this mostly as C started to lose a lot of ground, finally, to safer languages with infinitely better tooling. It's that too many people put up with bad bad tools, mostly because they prefer very very incremental changes, and mostly those that give them results in "functional requirements".)

Re:JVM/Java: Null-Restricted and Nullable Types by staticlink on Friday August 02, 2024 @06:16AM (#41137547)
Scala is doing fine-ish.
Re:JVM/Java: Null-Restricted and Nullable Types by CharlieDigital on Friday August 02, 2024 @06:23AM (#41137570)

    > Java is not an innovative language and the fact it is evolving towards something better...
So basically C#?
Re:JVM/Java: Null-Restricted and Nullable Types by pjmlp on Friday August 02, 2024 @07:46AM (#41138035)
Ironically, given how C# came to be, Microsoft is now a OpenJDK contributor and has their own distribution, turns out it is quite valuable to do so for Azure.

Just like 60% of Azure runs Linux workloads, as per official numbers.

Interesting the rounds that the world makes.

Re:JVM/Java: Null-Restricted and Nullable Types by ygra on Friday August 02, 2024 @06:43AM (#41137667)
In this particular case it goes further. C#'s nullable-reference types are useful, have a few problems, e.g.

• The feature is compile-time only (unsurprising considering the type narrowing approach is very similar to how TypeScript works)

• It interacts weirdly with Nullable<T> for structs since that already came before, uses some of the same syntax, but works differently because it's actually a type at runtime.

Java seems to have the nice position here to make it consistent across value types and reference types (assuming Project Valhalla is ever done) and they seem to have opted to retain the types at runtime as well which will cause runtime checks. This may cause gripes about performance, but from a correctness standpoint it's definitely much nicer than just having APIs that tell you that null won't ever occur, only to still have that problem in certain cases.

Re:JVM/Java: Null-Restricted and Nullable Types by foooorsyth on Friday August 02, 2024 @06:16AM (#41137552)
>Java is not an innovative language

Wild statement. Java certainly was incredibly innovative upon release. It didn’t explode in popularity by accident.

Re:JVM/Java: Null-Restricted and Nullable Types by jeroenhd on Friday August 02, 2024 @06:46AM (#41137678)
"Java is not an innovative language" does not mean "Java was never an innovative language".

I get the feeling Java seems to have suffered from its early success, pioneering things like generics in GC languages, which competitors like C# were able to do better, but only because Microsoft decided to break compatibility between .NET 1 and .NET 2 or because there was no compatibility to break. After that, the language seems to have shyed away from innovation out of fear of breaking things for a long time.

In recent years, this has changed, but Java has a lot of language features to catch up on. Project Loom (green threading without coloured functions) is the first innovative thing I've seen Java do in recent history.

Re:JVM/Java: Null-Restricted and Nullable Types by pjmlp on Friday August 02, 2024 @07:49AM (#41138056)
Java has done many nice things, but "pioneering things like generics in GC languages," wasn't one of them.

Here is a list of GC languages with generics that predated Java:

CLU, ML, Standard ML, Caml Light, OCaml, Miranda, Haskell, Sather, Eiffel, Modula-2+, Modula-3.

Re:JVM/Java: Null-Restricted and Nullable Types by mu53 on Friday August 02, 2024 @06:21AM (#41137566)
that was 30 years ago? New Java developers have been born after the original inception and learned the language long after. Reputations change over time.

Core Java was staunchly against incorporating any functional features while the rest of the ecosystem was innovating

Re:JVM/Java: Null-Restricted and Nullable Types by Spivak on Friday August 02, 2024 @06:50AM (#41137715)
Sure, because Java isn't a functional language. Taking a wait-and-see approach to whether the style of programming will be a fad is defensible choice when you have to support it forever. And it kind of was a fad. The only thing that really came of it in most mainstream langages is passing functions as arguments. I've yet to encounter a code-base in the wild that's actually functional.
Re:JVM/Java: Null-Restricted and Nullable Types by noelwelsh on Friday August 02, 2024 @07:50AM (#41138064)
What does functional mean to you? From my POV I see lots of features in Java coming from the functional programming world, but perhaps I have a different understanding of the term to what you do.
Re:JVM/Java: Null-Restricted and Nullable Types by xxs on Friday August 02, 2024 @06:09AM (#41137507)
>Java is not an innovative language

Most of the innovation when it comes to concurrency, garbage collection, JIT did come from Java. Syntax - that's more of an opinion/preference.

My gripe with yet another "improvement" of the language is still the lack of headerless objects (aka value classes) - JEP 401[0]

[0]: https://bugs.openjdk.org/browse/JDK-8251554

Re:JVM/Java: Null-Restricted and Nullable Types by bkail on Friday August 02, 2024 @08:40AM (#41138361)
nullability is directly related to the value classes effort (the top article mentions value classes, and the JEP you linked mentions nullability): in order to get the most benefit out of value classes, you need some way to express guaranteed non-nullability to avoid needing to encode null (imagine Point[] vs Point![]): https://cr.openjdk.org/~jrose/values/flattened-values.html#i...
Re:JVM/Java: Null-Restricted and Nullable Types by xxs on Friday August 02, 2024 @10:35AM (#41139100)
'Value' classes would be useful in arrays only + some version of direct buffer mapping. All other cases are pretty uninteresting when it comes to performance or memory layouts.
Re:JVM/Java: Null-Restricted and Nullable Types by self_awareness on Sunday August 11, 2024 @02:07AM (#41214289)
Java is not an innovative language, but it's one of its strengths. We live in a world where everything new is being marketed as an improvement of the previous thing, which is often not the case. Java is a healthy counterbalance. It should evolve, but it's fine if it does it more slowly than others.