Non-ugly ways to implement a 'static' class or namespace?

thebluepandabear therealbluepandabear at protonmail.com
Wed Feb 15 07:23:39 UTC 2023


On Wednesday, 15 February 2023 at 02:14:30 UTC, Mike Parker wrote:
> On Wednesday, 15 February 2023 at 01:16:00 UTC, 
> thebluepandabear wrote:
>
>>
>> I think what you could say is that D lacks _encapsulation_ 
>> which is also an OOP concept. So D is partially OOP but not 
>> fully OOP due to there being no encapsulation in the language.
>
> D does not lack encapsulation, it's just that the unit of 
> encapsulation is the module. Everything private in a module is 
> encapsulated from the perspective of the public API.
>
> If you really want to prevent anything inside a module from 
> accessing the private parts of a class, you can put the class 
> in its own module.
>
> Must we continue beating this horse?

Why is the unit of encapsulation the module though? Makes no 
sense.


More information about the Digitalmars-d-learn mailing list