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.
Java is becoming more like Rust, and I am here for it
11–20 of 71 posts
Re: Java is becoming more like Rust, and I am here for it
#12It'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.
Re: Java is becoming more like Rust, and I am here for it
#13In 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
#14Re: Java is becoming more like Rust, and I am here for it
#15Re: Java is becoming more like Rust, and I am here for it
#16Re: Java is becoming more like Rust, and I am here for it
#17I think a better description is "Java is becoming more like C#", which got these immutable-by-default record types many years ago.
Re: Java is becoming more like Rust, and I am here for it
#18The 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…
Re: Java is becoming more like Rust, and I am here for it
#19Re: Java is becoming more like Rust, and I am here for it
#20The 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…