<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 December 2013 03:29, Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com" target="_blank">newshound2@digitalmars.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 12/7/2013 1:52 AM, Joseph Rushton Wakeling wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 07/12/13 02:10, Walter Bright wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I know well that people used to C++ will likely do this. However, one can get in<br>
the habit of by default adding "final:" as the first line in a class definition,<br>
and then the compiler will tell you which ones need to be made virtual.<br>
</blockquote>
<br></div><div class="im">
The disadvantage of this approach is that, if one forgets to add that "final",<br>
it doesn't just produce a performance hit -- it means that it may be impossible<br>
to correct without breaking downstream code, because users may have overridden<br>
class methods that weren't meant to be virtual.<br>
</div></blockquote>
<br>
D doesn't allow overriding non-virtual functions (unlike C++).<br></blockquote><div><br></div><div>But, that's irrelevant, because if they did forget 'final' as suggested, then everything is virtual, so your point has no foundation.</div>
<div><br></div><div>There is overwhelming (almost total) evidence that people barely use final, either due to inexperience/ignorance, indifference, or forgetfulness. I suspect those criteria probably cover close to 100% of the workforce.</div>
<div>It can't be the default state, there are no syntactic safeguards. You've agreed on that in the past. Have you doubled back, or do you still agree?</div><div><br></div><div>People who make the sort of _conscious choice_ for their OOP library that it should be the sort of java-like library where everything is overridable, can easily type 'virtual:' at the top, and make their intent explicit.</div>
<div>There's no such simplicity with final, because unlike the 'everything is virtual' case, where 'virtual:' is easily applicable and the compiler _will produce an error message_ if they forget, there is no such useful concept 'everything is final', only 'most things are final', which means final must always be micromanaged; 'final:' can't easily be used like 'virtual:' can.</div>
<div>And regardless, it remains prone to the risks in my second paragraph.</div></div></div></div>