<div dir="ltr">On 10 April 2013 23:15, Andrej Mitrovic <span dir="ltr"><<a href="mailto:andrej.mitrovich@gmail.com" target="_blank">andrej.mitrovich@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 4/10/13, Manu <<a href="mailto:turkeyman@gmail.com">turkeyman@gmail.com</a>> wrote:<br>
> The _problem_ is that functions are virtual by default.<br>
> It's a trivial problem to solve, however it's a major breaking change, so<br>
> it will never happen.<br>
<br>
</div>I wouldn't say never.<br></blockquote><div><br></div><div style>... don't get my hopes up!</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In fact, it might go hand-in-hand with changing how protection<br>
attributes affect virtuality (currently they do, I'd argue they<br>
shouldn't)<br>
<br>
For example one argument against allowing private and package methods<br>
the ability to be virtual is performance, namely these methods are now<br>
non-virtual and would suddenly become virtual if we allowed<br>
private/package overrides (because users typically don't mark<br>
private/package methods as final).<br>
<br>
However if we at the same time introduced a virtual keyword, then the<br>
private/package methods would remain non-virtual.<br>
<br>
What would break are public methods which are overriden but don't use<br>
the virtual keyword. So it's a breaking change but at least you won't<br>
get any performance degradation by accident.<br></blockquote><div><br></div><div style>Rather, you'll gain innumerably, thanks to every property/accessor now being non-virtual as it should be.</div><div style>You make a compelling argument, although I'm easily sold on sich matters!</div>
<div style>It could be staggered in over a few releases... ie, in one release, 'virtual' is introduced - does nothing - encouraged to update code, next release, complain that missing virtual is deprecated, next release, turn it on proper; compile errors...</div>
<div style>Walter would have a meltdown I think :P</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another reason I like the idea of a virtual keyword is that it<br>
documents the method better. The user of a library would clearly see a<br>
method can be overriden because it's marked as virtual, rather than<br>
having to guess whether the method was left non-final on purpose or by<br>
accident (accidents like that can happen..).<br>
</blockquote></div><br></div><div class="gmail_extra" style>Hmm, this sounds familiar... where have I heard that before? ;)</div></div>