8 ms·
> 90% of C++'s useless standard library, The Python library is even larger and doesn't seem to be a barrier. If you know `std::vector`, `<<`, and `std::sort` i
by sicp-enjoyer 4y ago
> 90% of C++'s useless standard library,
The Python library is even larger and doesn't seem to be a barrier. If you know `std::vector`, `<<`, and `std::sort` it seems you're set to contribute to most code bases.
> C++ would also not have been deprecated by Rust.
That's an overstatement, to say the least.
- tinco 4y agoIn Python the standard library is fairly easily traversed and understood and if there's a better way of doing something it's usually linked I think. In C++ we have.. this.. https://en.cppreference.com/w/cpp/algorithm/transform_reduce https://en.cppreference.com/w/cpp/algorithm/transform_reduce
- Silhouette 4y agoPython's standard library includes many modules for specialised applications and yet it's surprisingly lacking in fundamental data structures and algorithms. Personally I think that's the wrong way round. Simple things like building dicts from different data structures or working with optional values that can be something or None just aren't there and you always seem to end up with some kind of utils.py full of hand-written functions to do these things that everyone writes again every time when they would have been either built into the syntax or a one-liner using the standard library in some other languages. I agree that the C++ example is (one reason) why modern C++ has jumped the shark.
- moloch-hai 4y agoThat example is not how C++ is used. It would not pass code review.
- xigoi 4y agoWhy is code that wouldn't pass code review part of the language documentation?
- moloch-hai 4y agoWhy are there falsehoods in Wikipedia?
- xigoi 4y agoBecause it's written by random people who may or may not know the topic well. How does that apply?
- bmitc 4y agoI know supposedly "harder to learn" languages (i.e., functional languages), but my god does that example and C++ look impenetrable.
- moloch-hai 4y agoThat is not idiomatic C++. The author is showing off esoterica.
- bmitc 4y agoThanks for the heads up. From the outside looking in, my perception of the difficulty of learning C++ is knowing what is idiomatic or not, with the understanding that that differs depending on who you work for and with.
- moloch-hai 4y agoIt is the same as in other languages: you do the simplest thing that gets the job done. Loops, particularly C-style "for" loops, often do not count as simple, despite their familiarity: std:: algorithms leave less scope for error.
- tinco 4y agoIt's not? This is literally the function that I found I should use when I wanted to fold over a list I had. What would you recommend I use?
- moloch-hai 4y agoThe library function is fine, although the long name is unfortunate. The apparatus around applying it, in the example, is aggressively weird.
- tinco 4y agoI agree that the example is crazy. But the function is not fine, it's a testament to how unhinged the C++ standards committee is. Its existence is proof that the problems of C++ are not just with its history, but that it is an ongoing snowball of incompetence and bad decisions.
- GuB-42 4y agoI don't think it is an overstatement to say that that imaginary world C++ would have been deprecated by Rust. C++ complexity is also its strength. Highly backward compatible, even with C, and multiparadigm. It has classes, but you don't have to use them, it has exceptions, but you don't have to use them, it has templates, lambdas, smart pointers,... and again, you don't have to use them, but they are here if you need them. Even the "deprecated" features of C++ (like most things related to raw pointers) are heavily used today, even in new projects, because they are useful. Strip 90% of "deprecated" C++ and what you get is essentially Rust, but worse because it still has its C baggage without the advantage of being mostly compatible with C.
- adastra22 4y agoI read the exact opposite. He's implying that real C++ has been depreciated by Rust, but that wouldn't be the case with imaginary-world C++. (Rust has not replaced C++ in the real world. Not even close.)
- sicp-enjoyer 4y agoHow much of that can be attributed to it not having as much time to attract cruft? See Haskell, a very minimal and carefully designed language with a heap of complex and contrary extensions.
- dagmx 4y agoPython as a language is smaller even if the library is larger. You can do many many things in Python without needing to know much other than working with dictionaries. In C++, doing a sort or a string search is an ordeal. So much of common programming requires so much cognitive overload. C++ is not an easy language. Not by a long shot.
- sicp-enjoyer 4y agoI absolutely agree, but this comment referred to the library size as a major burden.
- dagmx 4y agoAh fair. Though I do think the issue they meant is perhaps the C++‘s STL is not fleshed out enough to be as ergonomic and useful as Python. Python’s standard library is not without its faults but I’m always so frustrated that the C++ STL stops just short of providing many things, and when it does, it requires writing out so much verbiage.