4 ms·
Rust is C++ done well. >turns out people with money on the line will not use a language that simultaneously takes away power from the programmer while also bei
by constantcrying 3y ago
Rust is C++ done well.
>turns out people with money on the line will not use a language that simultaneously takes away power from the programmer while also being more difficult to write.
Rust reduces the number of Bugs by being harder to write. C++ is already an incredibly complex and incoherent language, like any language "vendor lock in" works against people choosing the right tools.
- cies 3y ago> Rust is C++ done well. Then Zig is C done well :)
- patrick451 3y agoThis isn't exactly praiseworthy. If a language is so hard to write you can never actually produce a line of code, of course you will write zero bugs.
- constantcrying 3y agoOf course there is a ballance. But Rust isn't indecipherable nonsense which nobody can grasp. The language forces stronger assumptions about the code (e.g. lifetimes), which allows the compiler to guarantee that certain bugs can not happen.
- cies 3y agoSeems you are not arguing in good faith. What you say is true, but totally irrelevant: language creators are not trying to make useless languages.
- patrick451 3y agoReductio ad absurdum is a valid logical argument. There's nothing bad faith about it.
- lordnacho 3y agoI wouldn't call it bad faith, that's more when someone is evading the actual point. However I doubt anyone hits a wall with rust where they can't get anything written.
- ithkuil 3y agoIf you can learn to use C++ correctly then, with the right time investment and motivation, then you can learn rust without problems. The compiler mostly complains about things you wouldn't do in C++ anyway because it would either crash right now or it would be brittle code that would be easy to break later. I knew enough C++ when I learned rust that I never perceived the lifetimes to be something that gets in the way. My major pain points were: * Leaning a new standard library, the names of common functions and common tasks to do things like handling strings, iterators etc. Nothing weird, just lots of new stuff to learn * figuring out which libraries outside the stdlib are actually a de-facto stdlib that it's ok to just use/build around (assert_matches, bytes, ...) * endless despair of async rust. Anyway you need to compare apples to apples, with the total cesspool that c++ coroutines are
- wslh 3y agoI think is true that C++ is the most complex programming language and historically didn't came with batteries included (e.g. basic stable and secure libraries that really abstract the problem at hand). But I don't think Rust is C++ done well. It is another programming language. The Err and Ok could seem weird, traits could really be confusing. This is not against Rust, just saying that it is another programming language.
- constantcrying 3y ago>The Err and Ok could seem weird, traits could really be confusing. C++ allows similar error handling with std::optional (Some()/None in Rust) or std::variant (Err()/Ok() in Rust). C++ also has something similar to traits (with really unreadable syntax). C++ just has a worse syntax for Error handling, since variants aren't enums. If you are using C++ I suggest you still make use of these concepts.
- wslh 3y agoI wasn't saying either C++ or Rust are better or worse, just saying that Rust is not C++ done well which I think it is a very exaggerated claim.
- constantcrying 3y agoAnd I pointed out that C++ includes somewhat worse versions of those concepts.
- wslh 3y agoAnd where do you think C++ is better than Rust?
- jandrewrogers 3y agoFor my use cases, modern C++ is clearly more powerful/expressive than Rust in a couple areas today: metaprogramming and software where object lifetimes/ownership are unknowable at compile-time. These have a large impact on development productivity and software quality, so I'd be reluctant to give them up. Rust has a bunch of other odd gaps, e.g. lack of proper thread-local support, but I can live with that.
- lordnacho 3y agoIt's only harder in the sense that it's picky about what will compile. In c++ a lot of things will compile that really shouldn't, but that cost doesn't get counted in the "hard to write" reckoning. Somehow people don't add in the "oh crap it segfaulted, and I have no idea why" risk. IMO it's far better to have something that won't compile giving you a headache than something that compiles and costs you an unknown amount of time later. I still haven't had my rust code segfault. To get to the same place with c++ I had to run a whole load of tools that aren't the compiler, but that are also more obscure and not normally mentioned in the coding tutorials.
- constantcrying 3y agoYes, I wrote that in another comment. You gain something for your effort, which almost always makes it worth it.
- alphanullmeric 3y agoRust reduces productivity by being less powerful. Just look at the amount of copy and pasting/diy name mangling in the implementations of Axum and serde that are used to overcome the lack of overloading and variadics. The horrible interface of polars, the sheer verbosity of bevy. Macros galore, the dozen levels of indirection you’re forced to add by a supposedly zero cost borrow checker. No placement new, no Constexpr, no specialization, nothing. You can write c++ like rust, you can’t write rust like c++. if it wasn’t for backwards compatibility, c++ would have added almost every single selling point from rust like pattern matching and procedural macros, the only unique thing about rust would be the decisions it forces onto you and not the ones it allows. And that would truly show that it has nothing to offer. In fact carbon is that very language, a c++ with the features of rust that isn’t going to be held back by backwards compatibility. We’ll see in a decade which one has better adoption.