Slow performance compared to C++, ideas?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jun 5 22:17:49 PDT 2013


On Wed, Jun 05, 2013 at 09:14:08PM -0400, Jonathan M Davis wrote:
> On Wednesday, June 05, 2013 17:49:17 Walter Bright wrote:
> > I think we accomplish this in a simpler way:
> > 
> > 1. 'virtual' means a method is an "introducing" one.
> > 2. 'override' means a method overrides a base virtual function with a final
> > function.
> > 3. 'override virtual' means override with a non-final function.
> > 4. none means final and non-overriding.
> 
> 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.
[...]

Yeah, I think requiring 'override virtual' is a bit counterintuitive.
Generally speaking, if I'm overriding a virtual method, then I'm also
planning to expose the same API (i.e. a virtual method) to my derived
classes, so it should also be virtual in turn. Overriding a virtual
method with a final method is something exceptional (i.e. at the leaf
nodes of the tree of overridden methods), so it should be the one that
requires explicit specification.

As for no specification, I thought the whole point was to have it
default to final? So 'final' should be optional in this case.


T

-- 
It won't be covered in the book. The source code has to be useful for
something, after all. -- Larry Wall


More information about the Digitalmars-d mailing list