Code That Says Exactly What It Means
jmh530
john.michael.hall at gmail.com
Tue Oct 28 01:19:27 UTC 2025
On Sunday, 26 October 2025 at 14:55:07 UTC, Steven Schveighoffer
wrote:
> On Sunday, 26 October 2025 at 06:33:11 UTC, Peter C wrote:
>> Among D developers, the idea of adding a new visibility
>> attribute like scopeprivate often meets with scepticism. After
>> all, D already has private for module-level encapsulation and
>> package for sharing across sibling modules. And if you really
>> want to lock a class down, you can always put it in its own
>> module. So why bother?
>>
>> [...]
>
> This has been proposed and rejected many times. In D private is
> for the module. This is intentional.
>
> -Steve
To be fair, it keeps coming up because people (not me!) say they
want the feature and the reasons for being opposed to it have
never been that great. The people opposed say D’s unit of
encapsulation is the module, great, but what you’re really doing
is presuming a paradigm of programming that is different from how
they want to work. If D advertises itself as a multi-paradigm
language that supports object-oriented programming and a bunch of
object oriented programmers say they want scopePrivate /
privateScope (and several get upset and leave the community),
then it doesn’t really come across as that supportive of the
paradigm.
More information about the Digitalmars-d
mailing list