Slow performance compared to C++, ideas?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jun 6 08:40:18 PDT 2013


On 06/06/2013 05:00 PM, Steven Schveighoffer wrote:
> On Wed, 05 Jun 2013 21:14:08 -0400, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>> I would have expected something more like
>>
>> 1. 'virtual' means a method is an "introducing" one.
>> 2. 'override' means override with a non-final function.
>> 3. 'final override' means a method overrides a base virtual function with a
>> final function.
>> 4. 'final' by itself both mean final and non-overriding.
> 
> I agree, I think it can be expressed by answering two questions:
> 
> 1. Do you want to participate in a base class' virtual call
> 2. Do you want to allow derived classes to participate in the virtual call.
> 
> If you answer yes to 1, add override, otherwise (or if there is no base method),
> add nothing (in C# answering no, you should add 'new' if there is an existing
> base function)
> If you answer yes to 2, add virtual, otherwise, add final.

I see a potential problem with allowing 'final' on its own to mean 'final and
non-overriding', which is that if you _mean_ to override a function in the base
class, but put simply 'final' and not 'override', it will still be accepted by
the compiler -- and it may not be obvious that the override is not taking place.

So, I think 'new' could have a place here after all.


More information about the Digitalmars-d mailing list