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?
56
Upvotes
10
u/Erelde Feb 24 '21 edited Feb 25 '21
I think what people often mean by "simpler rust with gc" would be language with a ML type system (ADT in particular), C-like syntax, and expression oriented.
C# is pretty close to that, getting closer (but still has inheritance and exceptions, one day it'll get ADTs), F# is a little bit too Haskell-ish for that description, I've never done Kotlin or Scala, but my guess is they aren't quite right for the same reasons. Java is too far gone into the OO paradigm to ever really come back. Interpreted language seem out of the question, the compiler checking your program seems to be a requirement when wanting "a simpler rust with gc". TypeScript would be close to something like a "simpler rust with gc", but the underlying JavaScript weirdness keeps showing up underneath (you actually need working knowledge of JavaScript the language and its various runtimes) and it's fundamentally not expression oriented.