3 ms·
Counterpoint: this kind of fiddling is what makes C++ unpleasant and unproductive language. You spend so much time finding solutions to problems that don't exi
by kjksf 2y ago
Counterpoint: this kind of fiddling is what makes C++ unpleasant and unproductive language.
You spend so much time finding solutions to problems that don't exist in other languages and contribute nothing to actually shipping the software
"Let's make this member private, because others should not touch it".
"Shit this function I just wrote must touch it. I know! I'll add a friend declaration".
Now you changed the header and spend 5 minutes recompiling the whole program.
I speak as someone who wrote 120k loc of C++ in SumatraPDF.
I just don't bother making things private. Or to put it differently: I use other ways to do it, when possible (confine as much as possible to .cpp files, don't expose classes at all) but if I can't hide the whole class like that, I would rather expose it all than waste my cycles on micro-managing visibility.
"Ok, it works for you but surely won't scale to large teams!"
All the giant ruby, python, javascript codebases tell us otherwise.
On a side note: I don't think I ever seen Go being praised for coming up with the brilliant design of making public / private visibility a matter of a module, not struct, like literally everyone else, even those who did it after Go. This strikes the perfect balance of being able to hide details of a module without affecting productivity of people implementing the module.