Sealed classes - would you want them in D?

jmh530 john.michael.hall at gmail.com
Fri May 11 15:02:08 UTC 2018


On Friday, 11 May 2018 at 14:05:25 UTC, KingJoffrey wrote:
> [snip]
>
> Actually, it is completely on topic. (although I understand 
> that many on this forum are very eager to shut down any 
> discussion about fixing class encapsulation in D, for some 
> reason).
>
> i.e, to be more specific.. so you can understand...my reply to 
> 'do I want sealed classes in D', is simply no. What I want 
> first, is a class that can properly encapsulate itself.
>
> Until that occurs, any talk about expanding the class concept 
> with yet more attributes (that probably won't mean what you 
> think they mean), like sealed, is just irrelevant and pushes 
> the problem of broken encapsulation even further down peoples 
> code paths.
>
> private is not private at all in D, and because of this, 
> classes are fundamentally broken in D (by design apparently).
>
> Now.. I really do have better ways to spend my time. I've made 
> my point. Nobody who uses D seems to think in a similar way, 
> apparently, so I leave it at that.

I think the last point in the conversation was "write a DIP". 
Nothing is going to change unless someone does that.

Personally, I don't agree with the idiomatic D doesn't use 
classes much argument. If that's the case, then they should be 
removed from the language. The language supports OOP/inheritance 
and if this is something that makes that experience better, then 
let it stand on its merits. But a new keyword will not get added 
without a DIP.


More information about the Digitalmars-d mailing list