Code That Says Exactly What It Means

Zealot zealot at planet.earth
Thu Oct 30 13:12:23 UTC 2025


On Thursday, 30 October 2025 at 11:30:47 UTC, Arafel wrote:
> On 10/30/25 11:20, Zealot wrote:
>> and you can simply do this for the exact same result:
>
> That is a slippery slope. Of course you can manage visibility 
> by convention: python does it, and is widely successful, 
> whether because or in spite of it.
>
> Now the question is that if you go this way... why do you then 
> need any visibility attributes at all? Because to me this seems 
> like the worst of both worlds: you have some attributes 
> enforced by the compiler, and some others enforced by 
> convention. Now that's cognitive load.
>
> Also please don't misunderstand me. While I would prefer and 
> use something like `scopeprivate`, I come from java. This means 
> that having one class per file* feels kind of good enough to 
> me, so I'm not going to make a fuss about it.
>
> *: Actually, you can have more than one class per file, just 
> one public one. But it feels really unidiomatic.

the difference is that nothing is stopping you from simply 
editing the class, when you edit the file anyway, so the 
protection would just prevent accidental use.
there'S also nothing stopping you from not using scopeprivate, 
that is also just a convention you'd have to use. sure the 
compiler would enforce it, but the point is: it's a non issue for 
it not to do so.


More information about the Digitalmars-d mailing list