I think the main issue is the quantity and density of complexity in the language (which is just a side effects of its long existence). A lot of it is hidden, or implicit; probably why people call them footguns, too.
I used to write C++ for a few years, and the mental burden is real, you just stop noticing it. Having come back to C++ for an old project a few months ago, and writing it felt like a chore. Maybe I just never liked it without realising, and it's only just surfaced, though!
I think the flaw with C++ is that it's too low-level for high-level applications, and it's too complex for performance-sensitive applications. I don't know what it's really good for. It feels far easier to use either extreme of C or Python/JS depending on the job. C++ seemingly grew to fill the high-level space that others have already filled better by now.
I worked on a C++ codebase that was essentially C with a few obvious domain classes and the addition of std::string and std::vector for convenience. I suspect that this is quite a common space, and it's immune to the march of the whizzy new features that are being added. Probably the only remotely modern bit of C++ that we could have benefited from is a salting of std::moves to remove some redundant copying, but this wasn't really worth the candle tbh.
For what it’s worth, I treat C++ as C with a basket of goodies that you can use if it makes your code better (at least in the context of performance-sensitive stuff). Things like templates and classes can help if you don’t overuse them. STL is nice for rapid prototyping and writing tests. But I agree with you it’s often the case where people go overboard with the abstraction and cause an incoherent, slow, buggy mess
Yeah, that discipline works when you're solo, but in a team each person will have their own ideas. Mine would be to avoid using classes, and someone else would OOP it up.
Comments
I think the main issue is the quantity and density of complexity in the language (which is just a side effects of its long existence). A lot of it is hidden, or implicit; probably why people call them footguns, too.
I used to write C++ for a few years, and the mental burden is real, you just stop noticing it. Having come back to C++ for an old project a few months ago, and writing it felt like a chore. Maybe I just never liked it without realising, and it's only just surfaced, though!
I think the flaw with C++ is that it's too low-level for high-level applications, and it's too complex for performance-sensitive applications. I don't know what it's really good for. It feels far easier to use either extreme of C or Python/JS depending on the job. C++ seemingly grew to fill the high-level space that others have already filled better by now.
I worked on a C++ codebase that was essentially C with a few obvious domain classes and the addition of std::string and std::vector for convenience. I suspect that this is quite a common space, and it's immune to the march of the whizzy new features that are being added. Probably the only remotely modern bit of C++ that we could have benefited from is a salting of std::moves to remove some redundant copying, but this wasn't really worth the candle tbh.
For what it’s worth, I treat C++ as C with a basket of goodies that you can use if it makes your code better (at least in the context of performance-sensitive stuff). Things like templates and classes can help if you don’t overuse them. STL is nice for rapid prototyping and writing tests. But I agree with you it’s often the case where people go overboard with the abstraction and cause an incoherent, slow, buggy mess
Yeah, that discipline works when you're solo, but in a team each person will have their own ideas. Mine would be to avoid using classes, and someone else would OOP it up.
C++ is a swiss army knife that can do everything, it's designed so that you don't need any specialized language at all.
If you do, you can just make an embedded domain specific language, since it supports that too.
C++ lambdas behave exactly like functions in any other functional language.
In OCaml, for example, you can't do recursion for the same reason without the special "let rec" construct.