<div dir="ltr"><div dir="ltr">On Fri, Mar 13, 2020 at 5:15 PM Dennis via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Friday, 13 March 2020 at 15:08:34 UTC, IGotD- wrote:<br>
> Instead of having final as default, can't the compiler itself <br>
> infer when a class is implicitly final and do the optimizations <br>
> itself?<br>
<br>
The problem is that only at runtime are all the derived classes <br>
known, and by then the code is already compiled. I think the Java <br>
Virtual Machine can automatically elide virtual calls by virtue <br>
of being a JIT, but for D this would mean either telling the <br>
compiler 'assume all derived classes are present in the source <br>
files provided here' or doing fancy link-time optimization.<br></blockquote><div><br></div><div>I believe LTO could do that in some casesĀ </div></div></div>