Sealed classes - would you want them in D? (v2)

KingJoffrey KingJoffrey at KingJoffrey.com
Thu May 17 13:38:36 UTC 2018


On Thursday, 17 May 2018 at 13:28:19 UTC, Steven Schveighoffer 
wrote:
>
> Essentially, if you put your class you want "sealed" into it's 
> own module, and then publicly import the module from the API 
> module, you will get the same effect. This is even easier now 
> with the package module than it used to be.

Fair enough. Now no OOP programmer has any need to take at look 
at D.

I can already do that in other, better known, better supported 
languages.

Indeed, i can put more than one class in a class file in those 
languages, and, I still get the guarantee of correctness at 
compile time.

> What private currently does is rational and makes sense. It's 
> not the same as all other languages, but it is the same as some 
> of them. It's simply a preference, and D picked something 
> different from what you like. There are things I would have 
> picked differently than D also, but not much to be done about 
> those choices at this point.
>
> -Steve

The other persepective is also rational, and makes sense.

I believe both perspectives could be accomodated, and at the same 
time without breaking anything, and without affecting in any way, 
the way people currently use the module.

The change would be completely blind to those people, until they 
choose to opt in to the change.

If D is at the point where change can no longer occured, it's 
over for D.




More information about the Digitalmars-d mailing list