Sealed classes - would you want them in D?

KingJoffrey KingJoffrey at KingJoffrey.com
Tue May 15 00:28:42 UTC 2018


On Monday, 14 May 2018 at 19:40:18 UTC, 12345swordy wrote:
>
> A slippery slope fallacy isn't helping your case. Write a DIP 
> if it bothers you so much, as it changes the languages 
> fundamentally.
>
>
> Alexander

If 'getting a module to respect the enscapsulation boundaries the 
programmer puts in place would change the language so 
'fundamentally', then the language 'already' presents big 
problems for large complex application development.

Little old me ranting about it in some DIP isn't going to do much.

D is great for small, quick stuff though - I'll give it that. I 
enjoy using D for small stuff.

But C++/Java/C# users all expect private to mean private, as it 
should, and will, like me, get a nasty shock when they come over 
to D, and discover it my mistake, as I did.

It was only through debugging my code, did I realise I had 
disprespected the boundaries I set up, because the module let me 
do it, and the compiler thought that's what I must have wanted. I 
simply could not have made that mistake in any of the other 
langauges I use.

Clearly others take a different perspective on this issue, that's 
fine, I just don't get the case they're trying to make. It hasn't 
made any sense to me thus far.

Removing respect for encapsulation boundaries, in order to 
avoiding the need for using C++ like 'friend', sounds a bit dodgy 
to me. No matter how much I think about it, I'd rather have those 
boundaries and be forced to use friends.



More information about the Digitalmars-d mailing list