4 ms·
I don't think C++ is actually that complicated. However, I do think C++ tries to use way too many different permutations of the ()[]{}<> characters. Once you tr
by munchbunny 8y ago
I don't think C++ is actually that complicated. However, I do think C++ tries to use way too many different permutations of the ()[]{}<> characters. Once you try to stuff too many of them into the same piece of code, you end up having to read code twice, once to figure out what the braces are for, again to figure out what the code is doing.
As an example, the < and > characters may indicate comparison (< and > in boolean expressions), a template declaration (< and > with a comma separated list following a function/class name declaration), a template specialization, an operator overload, an object access via pointer (->), a bit shift, (<< or >>), and possibly writing to a stream (<<).
A less egregious example, [] might be used to indicate indexing into an array, indexing into an object via overloaded [], declaring an array type, or declaring the captures in a lambda. While you can figure it out contextually, it's often irritating to have to figure out context first and then interpret the code.
- gumby 8y agoThey consciously try not to add many keywords or reserved characters. That has the downside but so does the alternative. I do agree that the stream operators << and >> was a bad experiment in retrospect.