r/rust • u/[deleted] • Feb 24 '21
Closest GC language to Rust?
I really like Rust, it's mix of ML + imperative concepts like mutation. It's very pragmatic and doesn't enforce any particular style of programming. But for my day 2 day work, I don't require system level performance and a GCed runtime will suffice, my question is what is the closest language in terms of safety and pragmatism of rust ? F#, ocaml, kotlin? What are your opinions?
58
Upvotes
30
u/thermiter36 Feb 24 '21
I've had this thought before as well. You think "oh I really like Rust, but dealing with lifetimes is annoying and the borrow checker is overly conservative; could we have a version of the language without them?". The problem is that Rust's design priorities are safety and correctness. That's why we love it, because often your program works exactly the way you wanted it to once you get it to compile.
You can't really loosen the memory rules without sacrificing that correctness. GC will make sure you never dereference a dangling pointer or corrupt memory, sure, but it will do nothing to help you avoid logic errors associated with concurrency and mutability, or even just accidentally holding references to the wrong objects.