Broken?

Manu turkeyman at gmail.com
Tue Mar 11 20:04:38 PDT 2014


On 12 March 2014 07:28, Dicebot <public at dicebot.lv> wrote:

> On Tuesday, 11 March 2014 at 21:24:22 UTC, bearophile wrote:
>
>> Dicebot:
>>
>>  Not in 2.065
>>> 2.066  will introduce "virtual" keyword
>>> 2.067+ will change the defaults if it will still be considered good idea
>>>
>>
>> What's the point of having "virtual" if the default doesn't change?
>>
>> Bye,
>> bearophile
>>
>
> frequently mentioned example:
>
> class Something
> {
>     final: // want all to be final by default
>
>     // ...
>
>     virtual void foo() {} // but this one function
> }
>
> I think just keeping "virtual" but not changing defaults is a good
> practical compromise.
>

I'm really trying to keep my lid on here...

I'll just remind that in regard to this particular point which sounds
reasonable, it's easy to forgot that *all library code where the author
didn't care* is now unusable by anybody who does. The converse would not be
true if the situation was reversed.

virtual-by-default is incompatible with optimisation, and it's reliable to
assume that anybody who doesn't explicitly care about this will stick with
the default, which means many potentially useful libraries may be
eliminated for use by many customers.
Also, as discussed at length, revoking virtual from a function is a
breaking change, adding virtual is not. Which means that, instead of making
a controlled breaking change with a clear migration path here and now, we
are committing every single instance of any user's intent to 'optimise'
their libraries (by finalising unnecessarily virtuals) to breaking changes
in their ABI - which *will* occur, since virtual is the default.
According to semantic versioning, this requires bumping the major version
number... that's horrible!

What's better; implementing a controlled deprecation path now, or leaving
it up to any project that ever uses the 'class' keyword to eventually
confront breaking changes in their API when they encounter a performance
oriented customer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140312/5a0221dd/attachment-0001.html>


More information about the Digitalmars-d mailing list