Code That Says Exactly What It Means

Dom DiSc dominikus at scherkl.de
Thu Oct 30 15:03:26 UTC 2025


On Thursday, 30 October 2025 at 03:48:01 UTC, Steven 
Schveighoffer wrote:
> There has always been only ONE deficiency for this, and that is 
> documented unittests being allowed to use private symbols in 
> the module.

I consider not even this a deficiency, because unittests 
_within_the_same_module_ are per definition whitebox tests, so 
they should be allowed to use private stuff. (In C++ they are 
required to be "friends").

If you want to do blackbox tests, by definition they have to be 
written in a different file (as touching the original file would 
be a violation of "blackbox"). And then they really can't see the 
private stuff.

So, everything is fine.

Having scope private would simply be lying in your pocket. Not 
having this is a clear improvement.


More information about the Digitalmars-d mailing list