Slow performance compared to C++, ideas?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jun 2 09:37:38 PDT 2013


On 6/2/13 9:59 AM, Manu wrote:
> I've never said that virtuals are bad. The key function of a class is
> polymorphism.
> But the reality is that in non-tool or container/foundational classes
> (which are typically write-once, use-lots; you don't tend to write these
> daily), a typical class will have a couple of virtuals, and a whole
> bunch of properties.

I've argued if no dispatch is needed just make those free functions. 
_Everything_ in a class is supposed to be overridable, unless inherited 
and explicitly "final"ized. It's sort of a historical accident that 
things got the way they are. But in D we know better because we have the 
module-level privacy model and UFCS. So we should break clean from history.


Andrei


More information about the Digitalmars-d mailing list