Sealed classes - would you want them in D?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Thu May 10 18:59:37 UTC 2018


On Thursday, 10 May 2018 at 15:18:56 UTC, Bastiaan Veelo wrote:

> How about extending the behaviour of ‘private’, which means 
> private except for this module, to ‘final’, which would then 
> allow sub typing in the same module but not outside? It would 
> not break any code. Are there downsides to such a change?

This was exactly my thought. It fits right in there with Walter's 
reasoning, you already have access to the module's code so rather 
than make you jump through hoops to access, lift the restriction 
within the module.

To rikki's complaint, it would have the same unfortunate side 
affect of people complaining that they can't control the source 
code within the module. It wouldn't be an exception to the rule 
though, it would follow the rule. (I guess it depends on what 
rule you look at)


More information about the Digitalmars-d mailing list