On 18 March 2012 06:42, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
> On 3/17/12 9:24 PM, Manu wrote: > >> Yeah, I'm not really into that. I group things conceptually. >> Either way, I've never written a class where non-virtuals don't outweigh >> virtuals in the realm of 20:1. >> > > Then probably struct is what you're looking for. No, I definitely want a class. ref type, gc mem, etc. struct doesn't support virtual at all. I have 2 virtuals, this particular class has around 50 public methods, almost all of which are trivial accessors, called extremely heavily in hot loops. More similar classes to come. I've never in 15 years seen a large-ish class where the majority of methods are virtual. Who writes code like that? It's never come up in my industry at least. Maybe you'll occasionally see it in a small interface class, but D has real interfaces... On 18 March 2012 11:00, David Nadlinger <s...@klickverbot.at> wrote: > Is this even possible without LTO/WPO? Extending a class defined in a > library you link in (and for which codegen already happened) is certainly > possible… > It's not possible without LTO, which is crazy. Depending on an advanced optimiser to generate the most basic code is a clear mistake. I think we just need the ability to state 'final:' and mark explicit 'virtual's, the problem is mitigated without breaking the language. I can live with a policy where everyone is instructed to write code that way.