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

ProtectAndHide ProtectAndHide at gmail.com
Fri Feb 17 11:33:24 UTC 2023


On Friday, 17 February 2023 at 09:56:26 UTC, RTM wrote:
> On Friday, 17 February 2023 at 06:56:08 UTC, ProtectAndHide
>
>
> Thirty years passed since. Lessons were learned. Out of three 
> PLs of the newer generation (Rust, Swift, Go), two are not OOP, 
> basically.
>
> And no private/public/protected:
> https://doc.rust-lang.org/reference/keywords.html
> https://go.dev/ref/spec#Keywords
>
> :-P

this is not a discussion about one paradigm or language being 
better or worse than another.

btw. neither Rust nor Go claim to support OOP. They don't even 
have a class type.

so it doesn't suprise me they don't have a language mechanism for 
class-type privacy.

for OOP using classes, the class designer should be able to 
expose only that which should be exposed, and no more. in D, 
everything is exposed inside the module, and the only solution D 
provides to prevent this, is to not put any other code in the 
same module as that class - this includes not putting your 
unittests in that module either.

please compare apples with apples, not apples with sardines ;-)


More information about the Digitalmars-d-learn mailing list