Sealed classes - would you want them in D?

KingJoffrey KingJoffrey at KingJoffrey.com
Wed May 16 06:34:35 UTC 2018


On Wednesday, 16 May 2018 at 06:17:51 UTC, Uknown wrote:
>
> `public` by default is again not a problem. Just apply 
> `private` as necessary.

it's not a problem 'if' you 'remember' to use 'private'.

private 'within the module' is also not a problem, 'if' you 
'remember' that, when using private to encapsulate your class.

Again, other mainstream languages have already learn the lesson 
here, as to why public might not be a great 'default'.

knowledge is useful, I get it. so are safe defaults.

> Also, if you want the rust style `private`, D offers `package`, 
> which means private to the modules contained by a package.

Thanks for clarifying this.


More information about the Digitalmars-d mailing list