Jonathan M Davis <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #4 from Jonathan M Davis <> 2011-03-01 00:08:33 
PST ---
See bug# 4542. This issue is a highly debated one. TDPL says that you should be
able to override private (primarily with the idea of using NVI). dmd is not
currently implemented that way - private functions are _never_ virtual. NVI is
highly useful, but it can be essentially done with protected instead of
private, and if you make it so that you can override private methods, then you
can't inline them anymore unless you declare them final. So, you can currently
do NVI - you just have to use protected instead of private - and you get the
higher efficiency of private functions being inlineable, but dmd is not in line
with TDPL. On the other hand, if you make dmd in line with TDPL, then you can
use private for NVI (which is of some benefit conceptually at least - though
not really pratically-speaking), but then private functions are no longer
inlineable, which could be a definite performance hit. I'm not sure that it has
been definitely decided that dmd will be made to match TDPL in this case or if
TDPL will have to be changed. Walter has never said anything on the matter as
far as I recall, and I don't remember what Andrei said (if anything) the last
time it was discussed.

At this point, I'm inclined to say that TDPL should be changed, since I don't
like the idea of losing out on inlineable private functions without having to
mark them all as final, but I don't know what the plan is at this point (if
there even is one). I think that Andrei assumed that private was overridable,
because it is because it is in C++ (though C++ doesn't force everything to be
virtual like D does, so the cost there isn't the same) as oppose to having
discussed it with Walter, but I don't know.

So, it's clear that per TDPL, private should be overridable, but I don't think
that it's clear that TDPL is going to win out on this one. Walter (and possibly
Andrei) need(s) to make a decision here, and I don't know if they've even
discussed it.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to