Slow performance compared to C++, ideas?

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 2 14:23:58 PDT 2013


On Sunday, June 02, 2013 13:44:33 Jonathan M Davis wrote:
> On Sunday, June 02, 2013 12:37:38 Andrei Alexandrescu wrote:
> > 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.
> 
> There are four problems with that:
[snip]

Another issue is extern(C++). In discussions at dconf, it became clear that we 
need to support non-virtual member functions with extern(C++) in order to move 
the compiler to D. Daniel Murphy has been working on this and could give 
better details, but the UFCS trick isn't going to work for that, and the fact 
that functions are virtual by default makes it problematic at best and 
possibly prevents it outright. We actually need extern(C++) classes.

- Jonathan M Davis


More information about the Digitalmars-d mailing list