Final by default?

Daniel Murphy yebbliesnospam at gmail.com
Thu Mar 13 20:40:21 PDT 2014


"Walter Bright"  wrote in message news:lft8ok$2epl$1 at digitalmars.com...

> Also,
>
>      class C { final: ... }
>
> achieves final-by-default and it breaks nothing.

No, it doesn't, because it is not usable if C introduces any virtual 
methods.

On the other hand,

class C { virtual: ... }

_does_ trivially bring back virtual-by-default.

The idea that over the course of (at least) a year, having to add this to 
some of your classes (that the compiler identifies) is large and 
unacceptable breakage is just nonsense.

Eg In dmd's OO-heavy code, ~13% of the classes introduce a virtual method. 
In those 44 classes, every single non-virtual method needs to be marked as 
final (~700 methods) 



More information about the Digitalmars-d mailing list