4 ms·
Redundancy in C++ chiefly arises from textual inclusion as the mechanism for communicating about the capabilities of other modules. It's not because of a bad pr
by asfasgasg 8y ago
Redundancy in C++ chiefly arises from textual inclusion as the mechanism for communicating about the capabilities of other modules. It's not because of a bad preprocessor or programming skill.
- ktpsns 8y agoCan you give an example of what you refer to? In my impression, most of the redundancy in the C world comes from the header/code seperation, i.e. all the signatures are repeated. Another level of redundancy was added by C++ templates where one quickly needs to write lengthy expressions, but the newer C++ standards resolved much of that thanks to the "auto a = b" type keyword or the "use X = Y" definitions. Note that "CPY" addresses none of these issues.
- ajross 8y agoGrandparent's use of "textual inclusion" was just a fancy way of saying "header/code separation". As I read it you guys agree.
- rileymat2 8y agoI must be one of the few that like the header/code separation. When dealing with plain text, I get a more concise view of what is going, as well as a view of what should be used by other modules.
- s_ngularity 8y agoThe problem with the separation is mainly with making changes to code, not with reading the code as it currently exists. This problem is avoided at no cost in Go, where an external tool can be used to get the same concise view of all of the function types that you like, without needing to manually create and update header files.
- nixpulvis 8y agoWriting code takes effectively no time, reading and reasoning is the primary concern (for me anyway).
- asfasgasg 8y agoMy first question would be: how much experience do you have with other languages? Because C and C++ are the only two major languages that have this separation, and everybody else seems to get on fine without it. If you're knowledgeable about other languages, then fair enough, preferences vary. If not, I ask you to consider the possibility that you only like it because it's familiar.
- rileymat2 8y agoI have been programming for 20 years. C++/Python/JavaScript/Visual Basic/Objective C/Java. Most of my work these days is in JavaScript (Node). I agree it is annoying to write, but I find well documented headers to be more usable than the other environments, if the project is large enough that I cannot read everything.