Sealed classes - would you want them in D?

Uknown sireeshkodali1 at gmail.com
Wed May 16 08:20:23 UTC 2018


On Wednesday, 16 May 2018 at 07:53:36 UTC, aliak wrote:
> On Wednesday, 16 May 2018 at 06:34:35 UTC, KingJoffrey wrote:
>> On Wednesday, 16 May 2018 at 06:17:51 UTC, Uknown wrote:
>>> 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.
>
> I did not read the rust spec :p, but from the conversations 
> above I believe rust private is not D package. Rust private is 
> private in the module, package in D is all modules in a 
> package. D would be:
>
> module mod;
> private: // put this at top of file and everything below it is 
> not private
>
>
> public void f () {} // explicitly request this one to be public

Just checked the rust spec [0]. private in rust => accessible 
from that module and its descendants, which is what package in D 
is. private in D would be to that module only.

[0]: 
https://doc.rust-lang.org/beta/reference/visibility-and-privacy.html


More information about the Digitalmars-d mailing list