I thought myself a pretty decent C coder, certainly someone who was conscientious and took safety seriously. I am nevertheless often humbled when programming unsafe Rust as I discover aspects and errors I had not anticipated or thought through. I don't attribute this to Rust, but instead to the deceptively difficult problem domain.
> but instead to the deceptively difficult problem domain.
It's definitely a big part of it, but I think sometimes it is a Rust thing. Of course, motivated by the essential complexity, but accidental complexity is still complexity. I don't think or hope it's an existential issue for Rust, which is good. The sharp edges around pointer-reference nuances in unsafe, for instance, are being addressed by things like raw references (mentioned upthread). I think languages that explore this problem domain more might provide interesting alternative designs for what Rust handles through unsafe.
Not the parent poster, but in my experience - yes.
I mainly program in C++, and the past 5 years or so of writing Rust has drastically changed the way I write code (in general). Sometimes, if the problem is particularly hairy, I'll even write the code in a similar way in Rust first and then port it back to C++ after the compiler has helped me iron out my mistakes.
This was stabilized thirteen days ago, in Rust 1.82.0. addr_of_mut! was stabilized three and a half years ago, in Rust 1.51.0.
> you get my point?
I don't think Rust adds keywords very often. But I can acknowledge this is a subjective point. Additionally, in this case, it is literally a one sentence explanation: `&raw mut` is how you can create a `*mut T`, and `&raw` is how you can create a `*const T`. That's it. You can safely ignore this whole thing until you're writing some unsafe code. It doesn't feel like a large burden to me, though of course I am biased.
I don't think Rust is anywhere near as complex as C++.
I agree that it seems like the team has an appetite for change that's larger than I personally would agree is appropriate. We'll see what they end up shipping.
The basic C++ you need to know to survive is quite small. Not as small as C, but let's say twice as large.
There are some crazy complex parts in C++ but most people dont see those parts very often.
Rust on the other hand has a pretty huge base part that everyone needs to learn. Because certain normally simple things can get very complex in Rust and you start approaching the dark corners of the language very very quickly.
So yes, I belive Rust is more complicated that C++. And it is still growing
Interesting - I see your point, but in my experience the complexity most people reference in this context are things that are implicitly present in C++, like lifetimes.
That being said they do definitely make it hard to do certain types of things (data structures with cyclic references, etc). But that’s not quite complexity, that’s more of a constraint on expressing complexity
To me complexity comes from implicit lifetimes, operator overloading, turing-complete templates, unhygienic macros, lack of a blessed package manager/build system, many different types of implicit constructors/destructors used in different contexts, easy to hit language footguns, etc.
IMO lifetimes (and downstream interactions with things like async) are the most complex bit of Rust.
But for a fairly significant number of places in Rust projects you can avoid them. The same isn’t true for the complexities of C++ I listed above.
(All right, i don't actually know if this is old or new. But you get my point?