Live data from Hacker News

Java is becoming more like Rust, and I am here for it

joshaustin.tech

11–20 of 71 posts

Re: Java is becoming more like Rust, and I am here for it

#11

I imagine the lineage here is more Scala than Rust, right? Not that Scala invented these concepts, but if you’re looking for proven features with JVM implementations to add to Java, you’re probably going to look to Scala (and Kotlin) first.

The OpenJdk team has said multiple times that their inspirations are coming from ML and not Scala or Kotlin.

Re: Java is becoming more like Rust, and I am here for it

#12

It's consistently been impressive to me how thoughtful the Java language is being steered. Especially the explicit choice to NOT have an async keyword where other languages were all falling over themselves to add it, with all the complexity it entails (and in Rust it's a pretty awkward fit). Once projects Valhalla and Panama land Java will be transformed again. Exciting times.

I think async worked out pretty well with JavaScript. But that was added to an already async language, it was just verbose and awkward before the await keyword.

Re: Java is becoming more like Rust, and I am here for it

#13
What "immutable" means in Rust is very different from Java or any FP language for thar matter.

In Rust you can take any data structure and mutate it. There are hardly any invariants that you can force, unlike in Java. For example, strings are mutable in Rust. This, coupled with not being a language managed by GC, makes persistent data structures not practical or desirable.

Of course, mutability in Rust is very controlled, as variables being mutated can't be observed in an unsafe way. So it matters less if strings are mutable. E.g., you won't be able to mutate a string while it's used as a key in a hashmap.

But the fact is that, while Rust provides a high degree of safety, functions in Rust are usually side effecting, which means no referential transparency, no equational reasoning, hard to refactor, etc.

In Java, culturally speaking, you don't see much immutability, but when you have immutability, it tends to matter much like in FP languages. And Rust is definitely not one of those languages.

Re: Java is becoming more like Rust, and I am here for it

#14
Rust did not invent immutable by default. This appears to be some kind of blog spam. More than 50% of the "article" is just trivial code examples backing up a non-existent point. Perhaps the author is looking to get a job in Rust and is padding out their blog with "Praise Rust!" evangelizing.

Re: Java is becoming more like Rust, and I am here for it

#18
post #3

The article is using immutable records and sum types as “more like Rust” and I am just sitting in the corner, wondering whether everyone has forgotten that these things came from FP in the first place. In my mind, a language isn’t “Rust-like” because it uses concepts we learned in FP. We have languages like Haskell and, before it, ML. And I know ML didn’t invent it. We also have Scala, and for Scala, we don’t even ha…

[deleted]

Re: Java is becoming more like Rust, and I am here for it

#20
post #3

The article is using immutable records and sum types as “more like Rust” and I am just sitting in the corner, wondering whether everyone has forgotten that these things came from FP in the first place. In my mind, a language isn’t “Rust-like” because it uses concepts we learned in FP. We have languages like Haskell and, before it, ML. And I know ML didn’t invent it. We also have Scala, and for Scala, we don’t even ha…

Very interesting to see concepts from ML/Haskell/Scala and other FP languages being attributed to Rust. If you tell me that a language is “Rust-like,” my mind goes to borrow checking and memory safety, not FP, so I opened this expecting to see some memory safety features added to JNI or something like that.
Post reply on HN