Re:Embracing Modern C++ Safely, Book Review
by throwaway17_17 on Monday May 30, 2022 @11:45PM
(#31565921)
The argument that Rust is closer to C than C++ is usually not how it is raised in most discussion around complexity and similarity. Also, to be clear, the discussion is usually centered around ‘a replacement for C’ or ‘why Rust is not a C replacement when compared to <insert-other-language>’. From my massive forum lurking habit, at multiple places, the argument seems to be closer to the following:
Person 1 says, “Zig is a viable C replacement, Rust is a C++ replacement.” Person 2 responds, “Rust is absolutely a C replacement, Rust is so much more simple than C++, that they should not be compared. That simplicity, which is much closer to C than C++, is why Rust should be viewed as the ultimate C replacement.”
So, it’s not a clear cut statement that Rust is closer to C than C++. However, I certainly have taken that as the argument in most discussions I have seen.
Rust is not, in fact, much simpler than C++, and gets less so every release. In five years Rust will be obviously, fully as complex as C++ -- provided it is still used.
Maybe it is my stockholm syndrome of reaching out to C++ when I need something like it alongside my managed languages, but I definitly find template metaprogramming easier to follow, specially since constexpr and concepts, than the various kinds of macros available in Rust.
Extremely doubtful on of this claim... Again, really recommend learning the language...
Try to debug an error related to macro expansions in Serde, or how Pin semantics work in asynchronous code,....
Re:Embracing Modern C++ Safely, Book Review
by staticassertion on Tuesday May 31, 2022 @04:39PM
(#31574657)
Pointing to errors, of all things, as an example of Rust being more complex seems sort of hilarious given C++'s famous template errors?
Re:Embracing Modern C++ Safely, Book Review
by pjmlp on Wednesday June 01, 2022 @01:48AM
(#31578588)
Yes, they are famous, mostly in code bases that aren't using static_assert with type traits, or concepts.
Rust needs to compete with ISO C++ current, not ISO C++98.
To keep from fizzling out, Rust has to be much better than what it is trying to compete with, so pointing to something similar in an established language falls short.
In any case, C++20 has Concepts, which where used clear up the template error problem.
Re:Embracing Modern C++ Safely, Book Review
by staticassertion on Wednesday June 01, 2022 @01:19AM
(#31578407)
Yeah, I remember Concepts, glad to hear they're in. I haven't used C++ since 2015, and last I had heard Concepts had been pushed out of C++17.
I've also never seen anyone say that Rust is closer to C than C++, that also seems weird.