▲ | garbthetill 5 days ago | ||||||||||||||||||||||||||||||||||
doesnt rust still have the advantage of having no gc? I dont like writing rust, but the selling point of being able to write performative code with memory safety guarantees has always stuck with me | |||||||||||||||||||||||||||||||||||
▲ | noelwelsh 5 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
I think "no gc but memory safe" is what originally got people excited about Rust. It's a genuinely new capability in production ready languages. However, I think Rust is used in many contexts where a GC is just fine and working with lifetimes makes many programs more painful to write. I think for many programs the approach taken by Oxidized OCaml[1] or Scala[2] gives 80% of the benefit while being a lot more ergonomic to work with. When I see Rust topping the "most loved language" on Stack Overflow etc. what I think is really happening is that people are using a "modern" language for the first time. I consistently see people gushing about, e.g., pattern matching in Rust. I agree pattern matching is awesome, but it is also not at all novel if you are a PL nerd. It's just that most commercial languages are crap from a PL nerd point of view. So I think "no gc but memory safe" is what got people to look at Rust, but it's 1990s ML (ADTs, pattern matching, etc.) that keeps them there. [1]: https://github.com/oxcaml/oxcaml [2]: https://docs.scala-lang.org/scala3/reference/experimental/cc... | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | inkyoto 4 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
OCaml was[0] very popular in the high-frequency trade programming, especially because of its high performance and predictable latency despite having a garbage collector, plus, of course, because of the correctness of the code written in it. OCaml's GC design is a pretty simple one: two heaps, one for short-lived objects and another one for the long-lived objects, and it is a generational and mostly non-moving design. Another thing that helps tremendously is the fact that OCaml is a functional programming language[1], which means that, since values are never mutated, most GC objects are short or very short-lived and never hit the other heap reserved for the long-lived objects, and the short-lived objects perish often and do so quickly. So, to recap, OCaml’s GC is tuned for simplicity, predictable short pauses, and easy interoperability, whereas Java’s GC is tuned for maximum throughput and large-scale heap management with sophisticated concurrency and compaction. [0] Maybe it still is – I am not sure. [1] It is actually a multiparadigm design, although most code written in OCaml is functional in its style. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | vips7L 5 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
You can write safe and performative code with a garbage collector. They're not mutually exclusive. It just depends on your latency and throughput requirements. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | 0cf8612b2e1e 5 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
Considering how many applications are running in JS/Python execution speed or GC is a low concern for many programs. Ergonomics (community, compiler guarantees, distribution, memory pressure, talent availability, whatever) seem more meaningful. | |||||||||||||||||||||||||||||||||||
|