Sealed classes - would you want them in D?

Uknown sireeshkodali1 at gmail.com
Wed May 16 06:17:51 UTC 2018


On Wednesday, 16 May 2018 at 06:05:31 UTC, KingJoffrey wrote:
> On Wednesday, 16 May 2018 at 05:59:17 UTC, Tobias Müller wrote:
>> KingJoffrey <KingJoffrey at KingJoffrey.com> wrote:
>>> The problem is not so much D, but that C++/Java/C# 
>>> programmers, and many from other languages (Go, Rust....) 
>>> will expect private to mean private...not private..depending 
>>> on....
>>
>> Well, that's not entirely true.
>> Visibility in Rust is similar to D.
>> There's no one true language semantics that holds for all 
>> languages. That's
>> the point of having different languages.
>
> actually, private is default in Rust.
>
> public is default in D.
>
> also, in Rust, private is private within the module, *and* its 
> descendants.
>
> I don't believe that is the case in D (someone correct me if 
> I'm wrong)

`public` by default is again not a problem. Just apply `private` 
as necessary. Also, if you want the rust style `private`, D 
offers `package`, which means private to the modules contained by 
a package.


More information about the Digitalmars-d mailing list