|
|
|
|
|
by ncmncm
1648 days ago
|
|
We all know that Rust is "safe by default". That is part of what makes it complicated. Most of the complexity of C++ comes from its long history, with new features layered on old, extra junk you have to say to get the new stuff, and old stuff to stay clear of. E.g., constructors should be explicit, and lots of things should be const, and you have to call std::move() to pass a value that way, and implicit conversions can happen accidentally. But actually using it, sticking to the modern bits, doesn't depend on much in the way of new concepts. Writing libraries for general use depends on deep lore, but that doesn't leak out to users of the libraries, who just get libraries that can do more for them. In Rust, you need to learn a whole new regime to do even basic things. And, you need to learn workarounds for what C++ does but Rust doesn't, yet. There are literally thousands of times as many people who can answer questions about C++ than about Rust, so mysteries are shallower. |
|
Sure, but the same can be said of any language that’s significantly different from C++ (OCaml, or Erlang for example). That doesn’t mean they’re as complicated.
Rust syntax and semantics are basically ML syntax with curly braces and semicolons on top. Having already learned OCaml by the time I picked up Rust, all I needed to internalize was the borrow checker, which is simpler to appease than it first appears.
> There are literally thousands of times as many people who can answer questions about C++ than about Rust, so mysteries are shallower.
Again, this is an argument about adoption more than about the intrinsic complexity of the language. I agree it’s harder to find answers, but that’s always going to be true when the languages you’re comparing to are C/C++/Python/Java/JavaScript.
> But actually using it, sticking to the modern bits, doesn't depend on much in the way of new concepts.
I disagree that smart pointers and move semantics aren’t new concepts. But more importantly this is basically an admission that C++ is vastly more complicated. It doesn’t really matter that there are subsets of C++ that are simpler, because to be able to understand code written by other people, and old code, you will need to understand these bits. The same is not true of Rust.