3 ms·
One of C++'s great weaknesses is that it is just a huge language with too much stuff in. There are lots of reasons why this is, not worth re-exploring, but the
by quietbritishjim 1y ago
One of C++'s great weaknesses is that it is just a huge language with too much stuff in. There are lots of reasons why this is, not worth re-exploring, but the point stands.
There is a great irony that a replacement to C++ should have lots of features in it. (Not necessarily the same too-many features.) One of the key requirements of a real C++ alternative would be fewer language features.
- pjmlp 1y agoIt is telling that Ada and Rust are only ones that many people in the C++ community would ever consider. Because at the scale many companies use C++, the additions into ISO C++, for how bad WG21 process currently might be, don't land there because a group of academics found a cool feature, rather some company or individual has seen it as a must have feature for their industry. Sadly also a similar reason on how you end up with extension spaghetti on Khronos APIs, CSS levels or what have you. Naturally any wannabe C++ replacement to be taken seriously by such industries, has to offer similar flexibility in featuritis.
- quietbritishjim 1y ago> Because at the scale many companies use C++, the additions into ISO C++, for how bad WG21 process currently might be, don't land there because a group of academics found a cool feature, rather some company or individual has seen it as a must have feature for their industry. Maybe it's just me but, sorry, I cannot parse this sentence.
- trealira 1y agoI'm not them, but I'll try reordering the sentence to help you parse it better. As bad as the WG21 process might be, the additions into ISO C++ don't land there because a group of academics found a cool feature; they land there because some company or individual has seen it as a must-have feature for their industry.
- quietbritishjim 1y agoThank you :-)
- feelamee 1y agoWhy is a big number of features a problem? You can ignore them if you don't like/need them. Can you briefly explain which features can be thrown out and language will not miss a lot without them?
- quietbritishjim 1y ago> Why is a big number of features a problem? You can ignore them if you don't like/need them. You 100% cannot do that. I mean, you can if you're writing some toy project just for your own use. But as soon as you start interacting with other programmers, it's inevitable that some will use some other subset of language features. > Can you briefly explain which features can be thrown out and language will not miss a lot without them? I don't think that it's controversial that C++ is a huge language with many features, and I doubt I'm the best person to rehash that. One often quoted example is the multitude of ways to initialise a variable (Foo x = y; Foo x(y); Foo x = {y}; Foo x{y} and for default initialisation Foo x; Foo x = {}; Foo x{}; Foo x() (not really - that's the most vexing parse); Foo x = Foo()). There's multiple syntaxes to define a function including auto and decltype(auto) return types. There are const, consteval and constexpr - you may know the difference but I've forgotten. There are so many templating features that I wouldn't know where to start. Concepts are layered on top of that - which are useful and a good idea but no denying that it's layering extra complexity on top (which can be said for many C++ features). I've really just scratched the surface. The thing is, I learned C++ over 20 years ago, when the latest standard was C++03 (which was essentially the same as C++98). Even at the time, C++ seemed like a bit of a chunky language (e.g., compared to C or Object Pascal - languages tended to be simpler back then), but it was achievable to mostly understand it all. But each revision that passed has added a huge volume of features. So I really feel how big C++ is because it's even big compared to (an older version of) itself. I've mostly kept up over the years but I can't imagine how I would properly learn the language today from scratch - I feel like you don't really stand a chance unless you've also been closely following it for decades.
- feelamee 1y ago> But as soon as you start interacting with other programmers, it's inevitable that some will use some other subset of language features. I disagree. Such a problem will be in any language. So, any project should have a code style which will describe how you can do things and how you should not do them. > I feel like you don't really stand a chance unless you've also been closely following it for decades. From my experience, 2 years is enough. I started from zero and now I'm pretty good in C++. Although this can look like a really long time, but you should consider that to understand a lot of parts of C++ you need knowledge in computer science and programs design, which you should learn with any other language too.