Sealed classes - would you want them in D?

meppl mephisto at nordhoff-online.de
Wed May 16 08:28:51 UTC 2018


On Wednesday, 16 May 2018 at 03:12:03 UTC, Jonathan M Davis wrote:
> On Wednesday, May 16, 2018 02:39:22 KingJoffrey via 
> Digitalmars-d wrote:
>> On Tuesday, 15 May 2018 at 21:05:10 UTC, Jonathan M Davis 
>> wrote:
>> > ...
...
>
>> The best clarification I can find, regarding how D treat's 
>> private, is from this tiny little sentence (from which, I 
>> assume, the programmer is now meant to understand it's full 
>> implications):
>>
>> "Symbols with private visibility can only be accessed from 
>> within the same module"
>>
>> https://dlang.org/spec/attribute.html#visibility_attributes
>
> It specifies what private does quite accurately. If you want 
> something that's trying to point out how you might 
> misunderstand the spec or what problems you might run into, 
> you'll need to read something like Ali's book. The spec is 
> telling you how the language works, not trying to tell you how 
> you might misunderstand it or what misakes you might make.
...
>
> - Jonathan M Davis

a pitfall-section about 'private' and 'protected' in 
https://dlang.org/spec/class.html wouldnt hurt. KingJoffrey is 
not the first one at all who discovered this corner case 
_afterwards_. I saw it in the forum.
Additionally I am curious about the "you must read a 
book"-statement, if KingJoffrey learned almost anything by 
reading the specification-documentation except for a few pitfalls.


More information about the Digitalmars-d mailing list