Sealed classes - would you want them in D?

KingJoffrey KingJoffrey at KingJoffrey.com
Sat May 12 08:13:12 UTC 2018


On Saturday, 12 May 2018 at 07:39:04 UTC, Jonathan M Davis wrote:
> Ultimately, it's a tradeoff, and arguments can be made for and 
> against. But in practice, it works extremely well. You're 
> certainly free to not like this particular design choice, but 
> it's one that most of us have no problem with, and I'd be 
> shocked to ever see it change. So, you can be unhappy about it, 
> but complaining isn't going to change anything. You're either 
> going to have to just learn to live with it or not use D.
>
> - Jonathan M Davis

I'm not so much complaining about it, as warning others of it.

D modules do NOT (cannot) respect the encapsulation of the class, 
and therefore, D modules containing classes, can very easily (to 
borrow a phrase from Bertrand Meyer) start to resemble "a chunk 
of Swiss cheese that has been left outside for too long..".

As for using D, this is why I don't really use D for anything 
other than small tasks - where I can happily revert to procedural 
type programming ( C like), and not have to worry about the 
issues of broken class encapsulation - which will almost 
certainly lead to unexpected side-effects, and create whole new 
'class' of problems that D programmers have to deal with.



More information about the Digitalmars-d mailing list