Sealed classes - would you want them in D?
jmh530
john.michael.hall at gmail.com
Thu May 10 14:43:14 UTC 2018
On Thursday, 10 May 2018 at 13:47:16 UTC, rikki cattermole wrote:
> [snip]
>
> Adding a keyword like sealed isn't desirable.
>
> I'm trying to find fault of the concept, but it definitely is
> tough.
>
> You basically want protected, but only for specific packages,
> otherwise final.
>
> protected(foo, final)
My read was that he wants an escape hatch on final so that he can
extend the type in a module and not have to worry about people in
other modules extending them.
So if he has
module foo;
class A { }
final class B : A { }
in one module, he wants to be able to create a new
final class C : B { }
and keep class B as final so that no one else can extend it in
another module.
More information about the Digitalmars-d
mailing list