[Issue 4542] [tdpl] TDPL NVI example results in linker error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 19 15:35:27 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4542



--- Comment #13 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-10-19 15:35:23 PDT ---
What should have been done from day #1 is to implement the 'virtual' keyword
and make methods non-virtual by default. It goes hand in hand with 'override'.
I really don't know why virtual is on by default, maybe someone thought
polymorphism would be used a lot in D but it turns out templates are much
cooler to work with these days rather than OOP, just look at Phobos for
example. (ok the last part is highly subjective :) )

(In reply to comment #12)
> at the cost of performance in pretty much all programs.

I wonder what would happen to performance if we suddenly switched behavior and
made methods non-virtual by default (and require a 'virtual' keyword).

Of course you'd have to fix your code and add 'virtual' to base methods, but
this is practically an error-free refactoring since 'override' was already
required. You would get CT errors rather than weird runtime behavior (like
C++03).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list