Comment by troad
8 hours ago
As someone who's worked in both C++ and Rust, they're deeply similar languages. There are far more exotic languages out there. APL. Erlang. Forth.
In the grander scheme of things, Java and C# are literally the same language, Rust and C++ are twins, C is their dad, Forth is the owl staring through the dining room window, and Erlang is an alien spaceship passing over the house.
I've been writing Rust since 0.x versions.
> C is their dad
You can write "C with classes" in the "C/C++/Rust" language, and have users of all three tell you you're doing it wrong. The commonalities between them are mostly necessities of systems programming, FFI, and LLVM-style optimizations, but they all try to get there in different ways.
> There are far more exotic languages out there. APL. Erlang. Forth
Early Rust started as an Erlang clone, with task supervision trees and all (panics, lock poisoning, and the defunct UnwindSafe trait are vestigial features from that experiment).
Rust has more in common with Ocaml than C or C++. It's not a C family language, it just took C-like syntax to avoid the stigma of being "exotic" like the languages that inspired it.
Rust did copy move semantics from C++, but even that ended up being different enough to be incompatible with basic C++ design patterns. Rust chose to have only trivially movable types and guarantee absence of move constructors, so it can't even safely pass a C++ std::string.
> It's not a C family language, it just took C-like syntax to avoid the stigma of being "exotic" like the languages that inspired it.
I agree that Rust has very conventional C-like syntax, but I'd go further and say it has fairly conventional C-like semantics too, at least in its current iteration. I think you could safely duck type Rust itself as a C-like. :)
Strong agree that Rust has drawn great inspiration from the ML family by way of OCaml. Rust is a C-like with ML characteristics, which are its greatest quality, imho. On the other hand, I don't think there's much trace of Erlang left in Rust -- there's probably more Erlang in Go than Rust, and Go is squarely a C-like.
I think it's fair to say that Rust started out more exotic than it is now, but perhaps all that safe, C-like syntax has led to convergent evolution towards other C-likes?
> Rust did copy move semantics from C++, but even that ended up being different enough to be incompatible with basic C++ design patterns. Rust chose to have only trivially movable types and guarantee absence of move constructors, so it can't even safely pass a C++ std::string.
Right, but compare all of that to Erlang's actor-based message passing, where mandatory immutability averts the need to move or lock anything at all, and I think it's clear why one would group Rust with C++, and not Erlang.