virtual-by-default rant

David Nadlinger see at klickverbot.at
Sun Mar 18 07:27:03 PDT 2012


On Sunday, 18 March 2012 at 13:54:20 UTC, F i L wrote:
> […] I think you're assuming the compiler can't, in good 
> faith, optimize out virtual functions. Whereas I'm assuming it 
> can.

Which is wrong as long as you don't do link-time optimization, 
and DMD probably won't in the foreseeable future. I tried to 
explain that above, think extending Thread, which has already 
been compiled into druntime, from your application (which is a 
bad example, because thread member method calls are most probably 
not performance sensitive, but you get the point).

That's just for the technical details, though, as far as the 
actual language design is concerned, I don't think virtual by 
default is an unreasonable choice.

David


More information about the Digitalmars-d mailing list