<div dir="ltr">2013/2/23 deadalnix <span dir="ltr"><<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Friday, 22 February 2013 at 17:25:58 UTC, kenji hara wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5">
2013/2/23 deadalnix <<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Friday, 22 February 2013 at 15:32:42 UTC, kenji hara wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Yes, then the B's definition should raise "mutable A.foo() is not<br>
overridden but hidden in B" (but doesn't because of bug 8366).<br>
<br>
<br>
</blockquote>
I don't really understand why adding a special case for something that has<br>
no real use case.<br>
<br>
</blockquote>
<br></div></div><div class="im">
In old age, it had thrown HiddenFuncError in runtime, and some years ago,<br>
it had been changed to compile-time error.<br>
It is one of design in D to avoid unintended method hiding issue.<br>
<br>
</div></blockquote>
<br>
This whole overload on const (note overload, not override) has been introduced in the first place to solve problem that inout now solve in a superior way.<br>
</blockquote></div><br></div><div class="gmail_extra" style>No, const/inout overload does not intend to solve 'method hiding' problem.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>
To clarify the situation, I try to explain.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>class A {</div><div class="gmail_extra" style>  void foo() {}</div><div class="gmail_extra" style>  void foo() const {}</div>
<div class="gmail_extra" style>}</div><div class="gmail_extra" style>class B : A {</div><div class="gmail_extra" style>  override void foo() const {} // or inout</div><div class="gmail_extra" style>}<br></div><div class="gmail_extra" style>
<br></div><div class="gmail_extra" style>In above, B.foo does override _only_one_ vtbl entry, that is for A.foo() const.</div><div class="gmail_extra" style>Then in B's vtbl, another entry for mutable A.foo() is *never* filled. We call the state "B.foo() const hides mutable A.foo()". (If you really inherit mutable A.foo() in B, you should use alias declaration, "alias super.foo foo;")</div>
<div class="gmail_extra" style><div><br></div><div>Here you should be aware that, the B.foo() const fills just only one vtbl entry.</div><div style>Even if B.foo() const has covariant signature with both A.foo() and A.foo() const, it never fill two vtbl entries for them.</div>
<div style>It's not allowed.</div><div style><br></div><div style>Kenji Hara</div></div></div>