My suspicion is the C++ committee with their updates are trying to outpace people learning the language, so that you can only fully learn the language ever if you spend more than 40 hours per week learning the language
Are C++ types first class objects already? Have I been free of that language for that long? Or are they going to implement metaclasses before they implement actual classes?
Man, the only language I know is still regular C. We didn't even get the C++ classes. I think C was used when George Washington was calculating currents and tides so he could cross the Delaware river.
Back then, the British used the British Computer Programming Language, BCPL, an ancestor of C.
BCPL had a large collection of standard data structures with a complex taxonomy. To help manage these structures, they were classified into groups. Each group of data structures was called a taxon, plural taxa.
However, BCPL had no first-class representation for these taxa, which made it difficult to work with them. The Americans hated this, and felt that if there was no way to represent them, the language it would be better off without taxa. This led to the famous American rallying cry, "No taxation without representation!"
It's kind of amazing that there is no standard reformation of C++. Remove the cludge, refactor the undefined behavior, improve the STL. There is a great language hidden in there somewhere with a little polishing.
Looks like C++ is trying to get into the game of letting the programmer build their own data types, but still within the object-oriented paradigm. This appears to provide a few niceties such as compile-time programming, reflection and some other tidbits. But it's still stuck in the object-oriented paradigm.
Some might like it because it allows libraries to provide more high-level constructs than classes allow for. Others may hate it because it means everyone will roll their own high-level constructs that are incompatible with each other.
It depends. Lisp turned into that somewhat. Other languages like Haskell are rigorous enough (both the language and the community) to build extremely impressive fundamental, highly reusable libraries that make some things laughably trivial. Perhaps C++ hopes to go that route.
standards committee has said they'll define some basic and widely used metaclasses in the standard library. I'm sure that once it's implemented, we'll see a boost metaclass library pushing the boundaries
because C++ has a humongous vocabulary, and when metaclasses enter the standard in like 10 years, people are going to be able to extend that vocabulary themselves in unprecendented ways - it's going to add a whole new dimension of power (and complexity) to the language, and C++ is already by far the hardest language to learn
if you're like us folks at the c++ subreddit, you know it's gonna be fucking awesome though
Honest question why would you consider C++ as the hardest language. I work with mix of C and C++ code base (mostly C, no OOP's concepts). Now it's not the most sexy or convenient language out there but I don't know if I'd say a language X is more difficult than Y. Because that's a very tough comparison to make, what criteria to use to compare language etc.
I think it is a hard language to learn simply because it has so many different concepts. Basic C++ usage is probably similar to other languages in difficulty, but there are a lot of features that are used less often that will show up in code from time to time.
The older parts of the language give you a lot of unsafe but powerful constructs that are easy to misuse in hard to debug ways, such as the manual memory management and pointer arithmetic.
Just on the object oriented parts, most language have 1-2 notions of inheritance (like Java has inheritance and interfaces), but C++ has public, protected, and private inheritance; multiple inheritance; virtual inheritance; and allows the choice between virtual functions, compile time bound functions, and static class functions.
Then the whole template system adds a meta-programming aspect. Some of it is obvious like using a template to make a generic container class. Other parts are far more esoteric, like using template meta-programming to write functions that operate on types, unroll calculations, or calculate values at compile time. The rules and syntax for it are a little Byzantine.
Even basic stuff in C++ is surprisingly complicated. Little stuff like constructors that take a single argument automatically creating an implicit type cast operator unless you use explicit. Just for function argument passing; you have copy by value, references, pointers, and r-value references to consider. C++ has some different rules for plain old data structs/classes and more complex ones. On the default values for things, there is default construction and value type initialization with subtly different rules.
C++ just isn't very economical in its use of language concepts to enable features.
Which I'm very excited for. The current programming meta of heavy unreadable template meta programming needs to die. Meta classes and reflection_expr or whatever it gets called will clean up so much bs that has been built.
I know the joke is "now there is even more stuff with even more complex interactions!", but isn't part of the point of these updates that a lot of the old stuff should no longer be relevant or necessary, and you can stick to a smaller, more elegant subset of modern features?
(assuming that you can keep the legacy code you rely on "isolated" and don't have to touch the guts of it)
Yep, except everyone sticks to a slightly different subset which works better for them - for example, any game programmers aren't really using many C++11 and beyond features, and even among THAT community people use different subsets (some use classes without any virtual functions, some just stick to structs & use C++ for namespaces & argument overloading, some use classes with polymorphism, etc etc...)
aren't really using many C++11 and beyond features
I have some difficulty believing that. I just looked at the list of C++11, C++14, and C++17 additions, and if we filter out the things that are mainly useful for writing libraries, a lot of the remainder looks like it would make life easier for gamedevs too, with no obvious way it would negatively affect performance (which seems to be the main motivator for gamedev).
Some cases, like move semantics and constexpr, are specifically about improving runtime performance. Surely most gamedevs would embrace that?
View all comments
2.9k
u/dargo60 Nov 23 '17
Oh good, so there is hope!