4 ms·
To me, C++ suffers a lot from the "spoonful of sewage syndrome". Yes, C++14 is a lot prettier than C++, but they preferred to be backward compatible with a rott
by toolslive 12y ago
To me, C++ suffers a lot from the "spoonful of sewage syndrome". Yes, C++14 is a lot prettier than C++, but they preferred to be backward compatible with a rotting language. If people know that some things are bad, but prefer to retain them (for whatever reason), then they should not complain that at some point somebody comes along and just drops the insanity.
(yes, C++ would be a lot better (or less worse) if they would correct mistakes from the past).
Anyway, Rust is simply a language with a lot less cruft, combined with a better tool chain (compare rust compiler errors to g++ compiler errors). That's not a surprise, considered C++'s age (30+ years).
OTOH, without C++, Rust would have been impossible.
OTOH2, Rust wanted to be somewhere between C++ and OCaml.
I think they succeeded.
- jeorgun 12y agoNitpick: Comparing Rust's error messages and g++'s error messages, and saying that therefore Rust has a better toolchain, isn't really fair. pcwalton mentioned elsewhere in the thread that Rust's messages are based on clang's, which are orders of magnitude better than g++'s.
- alextgordon 12y agoC++ isn't full of cruft, it's full of features. Many of those features apply only to a small niche, but those all those small niches add up to become an audience. Much of the "cruft" of C++ stems from the template system. Rust has very sensibly decided not to go down that path. But aren't you happy that one language has sacrificed itself so that we can express ideas like this... template<typename T, size_t A, size_t B, size_t C> Mat<T, A, C> matmul(const Mat<T, A, B>& left, const Mat<T, B, C>& right) { ... The actually useless features like exported templates and trigraphs, are removed.
- frik 12y agoC++11/14 should have been a clearer break from legacy ANSI C++. Overloading of keywords just to avoid adding new keywords to the grammar (lexer/parser) - that's what makes C++ really ugly. Especially if one has to read through old third party code. The STL was so slow/bad that almost ever PC game shipped with their own implementation. (I heard STL implementations got better). Boost is too bloated, the compile time and executable increases and many avoid adding it to their project.
- pjmlp 12y agoWe all know how clean breaks work out....
- frik 12y agoYes, we know. But adding new keywords instead of reusing/overloading old ones for newer features would have been nice. Writing new code in C++11 isn't the problem, reading old ugly C++ code and trying to understand it is. I think the clean break is Rust and it already looks promising. Sure some of its syntax is influenced by non-C languages and looks a bit weird, but I can live with that.
- pjmlp 12y agoI like a lot of C++ (since C++ARM days), but I also like safe systems programming more (Ada, Modula-2, Oberon, ...). The question is if Rust will earn the hearts of an OS vendor and be available in their respective SDKs. Right now I see Apple going Swift and Microsoft making .NET compile straight to native code.
- frik 12y agoOperating systems today are mainly C based (majority of kernel mode code) - WinNT/ReactOS, Unix/Linux/*BSD/OSX/Android. Also in the user mode side, C is heavily used in all above mentioned OS (WinAPI, DirectX, etc. are all in C). C++ is also heavily used (e.g. for GUI applications like Office and newer OS development). Most third party applications are written in C++ inclusive almost video games of the last 15 years. Apple bought Steve Jobs' NeXT Software and with it NeXTSTEP (now MacOSX) and Object-C. I read somewhere that Microsoft is working on a Rust competitor and Swift with it's great syntax is refreshing. But with these closed languages, I hope that Rust has success. Ada is great and heavily used in specific domains - only its syntax is not that great. Also VHDL is based on Ada and its syntax. I had a Professor who had worked on Modula&Oberon with Niklaus Wirth, though he later moved on to Sun Java.
- 12y ago