<div dir="ltr">On 10 April 2013 18:11, Dicebot <span dir="ltr"><<a href="mailto:m.strashun@gmail.com" target="_blank">m.strashun@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 Wednesday, 10 April 2013 at 06:03:08 UTC, Manu wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A base class typically offers a sort of template of something, implementing<br>
as much shared/common functionality as possible, but which you might<br>
extend, or make more specific in some very controlled way.<br>
Typically the base functionality and associated accessors deal with<br>
variable data contained in the base-class.<br>
</blockquote>
<br></div>
I believe that template mixins + structs are much more natural way to express this concept. Basically, if you need inheritance only for code reuse, you don't need inheritance and all polymorphic overhead. D provides some good tools to shift away from that traditional approach. Those can and should be improved, but I think the whole concept "classes are polymorphic virtual reference types, structs are plain aggregates" is very solid and area of struct-only development needs to be explored a bit more.<br>

</blockquote></div><br></div><div class="gmail_extra" style>... nar, I don't think so.</div><div class="gmail_extra" style>A class is a class, I'm not arguing for anything that's kinda-like-a-class, I'm talking about classes. The fact that I (and sensible 3rd party libraries I would choose to use) minimise the number of virtuals makes perfect sense.</div>
<div class="gmail_extra" style>It's faster, it's easier to understand, you can see what functions you need to override to use the object effectively at a glance, behaviour is more predictable since there are fewer points of variation...</div>
<div class="gmail_extra" style>Nobody has yet showed me an example of a typical class where it would make ANY sense that all (or even most) methods be virtual. (Again, not talking about small/trivial or foundational/container classes, people don't write these every day, they write them once, and use them for a decade, and they probably like in the standard library)</div>
</div>