On Wednesday, 10 April 2013 at 15:38:49 UTC, Andrei Alexandrescu
wrote:
On 4/10/13 7:30 AM, Manu wrote:
The _problem_ is that functions are virtual by
default. It's a trivial problem to solve, however it's a major breaking
change, so it will never happen.

I agree. We may as well save our breath on this one.

Hence my passing comment that spawned this whole thread, I see it as the single biggest critical mistake in D, and I'm certain it will never be
changed. I've made my peace, however disappointing it is to me.

I disagree with the importance assessment, but am soothed by your being at peace.


Andrei

Why is virtual by default a problem?

You could have non-virtual by default and would live happily
until a day where you forget to declare the base class destructor
virtual. Then you spent a lot of time trying to find why you are
leaking memory.

In C++ you have to be aware all the time not to forget something
and screw everything. D is more forgiving, at a small cost of
performance.

So I don't buy the non-virtual by default argument. If your
profiler tells you that a particular virtual function is the
bottleneck, go on and make it final. That's why profilers exist.

Reply via email to