<div dir="ltr">On 10 April 2013 04:29, Rob T <span dir="ltr"><<a href="mailto:alanb@ucora.com" target="_blank">alanb@ucora.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 Tuesday, 9 April 2013 at 16:49:04 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
<br>
</blockquote>
final class Foo{ //no inheritance<br>
final: //no virtuals<br>
...<br>
}<br>
<br>
2 extra words and you are done. The only problem I see is that there is no<br>
way to "undo" final on a few methods later...<br>
</blockquote></blockquote>
<br></div>
final class Foo<br>
{<br>
   final //no virtuals<br>
   {<br>
      ...<br>
   }<br>
<br>
   // final ends, virtual methods below?<br>
   ....<div class="im"><br>
}<br></div></blockquote><div><br></div><div style>My point exactly. That is completely fucked.</div><div style>final on the class means you can't derive it anymore (what's the point of a class?), and the manual final blocks are totally prone to error.</div>
<div style>In my experience, 90% of functions are not (or rather, should not be) virtual. The common (and well performing) case should be default.</div><div style><br></div><div style>Any language with properties can't have virtual-by-default.</div>
<div style>Seriously, .length or any other trivial property that can no longer be inlined, or even just called.</div><div style>And human error aside, do you really want to have to type final on every function? Or indent every line an extra tab level?</div>
<div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

And any junior/tired/forgetful programmer will<br>
accidentally write slow code all over the place, and nobody will ever have<br>
any idea that they've done it. It's very dangerous.<br>
</blockquote>
<br></div>
I suppose, OTOH forgetting to make methods virtual can lead to another problem.<br></blockquote><div><br></div><div style>No it can't. override is explicit. You get an error if you forget to make a function virtual.</div>
<div style>And even if that was a risk (it's not), I'd take that any day of the week.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In general, perhaps we're still talking about the same problem as with how to ensure that portions of code do not contain unwanted features of the language. If you want to ban the use of virtual functions, there ought to be a way to do it easily, same for writing code that does not contain features of the language that require a GC, etc.</blockquote>
<div><br></div><div style>I don't want to ban the use of virtual functions. I want to ban the use of virtual functions that aren't marked virtual explicitly! ;)</div><div><br></div><div style>Likewise, I like the GC, I just want to be able to control it.</div>
<div style>Disable auto-collect, explicitly issue collect calls myself at controlled moments, and give the collect function a maximum timeout where it will yield, and then resume where it left off next time I call it.</div>
</div></div></div>