Final by default?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Mar 14 00:06:52 PDT 2014


On 3/13/14, 11:30 PM, Manu wrote:
> On 14 March 2014 16:20, Walter Bright <newshound2 at digitalmars.com
> <mailto:newshound2 at digitalmars.com>> wrote:
>
>     On 3/13/2014 8:40 PM, Daniel Murphy wrote:
>
>         "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.
>
>
>     That's what the !final storage class is for.
>
>
> Please don't consider !final, that's like pouring lemon juice on the
> would.

The "wound" should have nothing to do with the decision. It would be a 
mistake to add a keyword here because "well, we had to give them something".

The converse of final doesn't deserve its own keyword. Also we do need a 
means to negate others, too.

> Use virtual, it's a keyword that everybody knows and expects, and
> already exists in peoples code that they might be migrating to D.

That does apply to C++ and maybe C# but not to other languages.


Andrei



More information about the Digitalmars-d mailing list