4 ms·
> Rust isn't any more complex, but it's not radically simpler either. Safe Rust doesn't have classes, inheritance, copy constructors, move constructors, header
by pkolaczk 4y ago
> Rust isn't any more complex, but it's not radically simpler either.
Safe Rust doesn't have classes, inheritance, copy constructors, move constructors, header files, preprocessor, textual substitution macros, code executing before main(), exceptions, global variables, pointer arithmetic... Looks radically simpler to me.
- epicide 4y agoIn general, I think it's easy to conflate simplicity with ease. Ease is always a matter of context and what one is familiar with. I agree that Rust is simpler than C++ and I think a lot of people mean that Rust isn't easier (up front). Given how new and different it can be, that makes sense.
- sudosysgen 4y agoInstead Rust has a borrow checker, procedural macros of different types, half a parallel language when using unsafe, etc... And by the way, Rust does have pointer arithmetic. It's not clear to me that either is simpler or easier. The big point of Rust is really memory safety, not ease of use or simplicity.
- pitaj 4y agoRust doesn't have pointer arithmetic in the same way that C and C++ do. All you can do with pointers in rust is offset them.
- tialaramex 4y agoRust's slogan is: "A language empowering everyone to build reliable and efficient software." Now, that "everyone" there has a bunch of social consequences, like you're going to see a bunch more diversity in Rust's community than we've traditionally seen in this sort of endeavour. But it also means technically there's work put in to actually deliver on the slogan by making it easier for everyone to use the language. This is how Rust has those excellent compiler diagnostics. That's not an accident, it's part of "empowering everyone". Experts could manage with a compiler that outputs terse errors like "Syntax error, line 14" but that's not going to empower everyone.
- moomin 4y agoYes, but C++ isn’t complex because it set out to be complex, it’s complex because they’re constantly trying to enhance it whilst maintaining backwards compatibility with a system that was originally basically just a big set of CPP macros. Rust has a heck of a lot of features, but it’s got nothing like the “too perfect forwarding” problem of the language behaviour just being plain hard to predict.
- fooker 4y ago“Make things as simple as possible, but not simpler.” Rust lacking some of these makes it a somewhat unfriendly language to write libraries in.
- al_mandi 4y agoWhy are classes automatically somehow assumed as complex? Rust's structs are basically classes without class inheritance.
- learn-forever 4y agoDealing with inheritance is pretty complex!
- al_mandi 4y agoRust has traits (similar to interfaces). And limiting to single inheritance like Java/C#/etc. makes things quite manageable.
- zahllos 4y agoThe idea of classes on their own isn't complicated. The problem is that C++ provides an extreme amount of flexibility in how you use them. You can have multiple inheritance. You can have as many levels of partially implemented, partially abstract classes as you like provided you eventually have a concrete class, and these abstract classes can have member data. You can have static methods, which I've seen abused as namespaces so often. You can have static methods and non static ones in a class hierarchy. Finally you can mix templates into this. In an ideal world the developers of a project in a company would collaborate to keep this from getting out of control and enforce a relatively consistent philosophy. However in practice people have their quirks and specific not always rational views, and programmers are in general not always the best at dealing with other people, programmers included. So a strong personality is determined to do it one way and refactors a bunch of code to their liking, and on and on, and now a variety of features have been used in different ways. No language is immune to this as it is fundamentally a human problem, but taking out features generally helps. Since we can get by without inheritance most of the newer languages have done away with it.