On Monday, 22 January 2024 at 22:59:17 UTC, Walter Bright wrote:

...
C++ private isn't private, const isn't constant, and one can throw from nothrow functions.


But that, vI assume you mean that in C++ you can return pointers/references to private mutable class members, and therefore 'private isn't private'.

If that is what you're referring to, then that does not negate the value of class private members in C++.

Nor is it argument against an option for class private members *within* a module, in D.

There is only 1 valid argument against introducing an option for module level class private members in D. And that is, a programmer (as in all programmers who use D) should never need to control the visibility of a class types mutable state to other code in the same module (including unittests).

But is that true?

I mean either it is, or it isn't.

The option presented, i.e. to put the class type in a module by itself, does not answer this question (since there is no other code in the module).

Any answer to this question has to take into account the other code in the module.

Reply via email to