<div dir="ltr">I have said that "method const qualifier inference on class inheritance is bad".<div><br></div><div>With 8138 or 8366, such inference suddenly add const qualifier to one of overloaded functions, and changes the meaning of overload list. More than worse, it may introduce newly relation between overloaded functions, and in the worst case, it will add new forward reference problem.<br>
</div><div><br></div><div class="gmail_extra">class C : B  // or class C(T)</div><div class="gmail_extra">{</div><div class="gmail_extra">    void foo() { ... foo(10);  ... }</div><div class="gmail_extra">    void foo(int n) { ... foo(); ... }</div>
<div class="gmail_extra">}</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">For pure/nothrow/@safe inference, if a mutual dependency is found, the attributes are inferred to impure/throwing/@system due to avoid forward reference issue.</div>
<div class="gmail_extra">But, we cannot define such 'default qualifier' for const inference. So it must raise  forward reference error if a mutual dependency is found. AND it will break existing valid code.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">And bug 8366 can allow to hijack derived class by base class. If a base class add const qualifier to its method, it affects to the overload list in its derived class, not only the method that directly overrides modified one.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">We should avoid language features that is hijacking/fwdref error prone.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Kenji Hara</div></div>
<div class="gmail_extra"><br><div class="gmail_quote">2013/2/19 deadalnix <span dir="ltr"><<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Monday, 18 February 2013 at 07:46:24 UTC, kenji hara wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

I think const must not be inferred for member function, because it affects<br>
to the function overloading. For example, the const-ness for class method<br>
will be inferred from base class overridden method with current compiler,<br>
but it causes a serious problem.<br>
<br>
<a href="http://d.puremagic.com/issues/show_bug.cgi?id=8366" target="_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=8366</a><br>
<br>
Instead, you should declare two methods in generic code - one is mutable,<br>
and another is const/inout.<br>
<br>
</blockquote>
<br></div>
I remember mentioning overloading on const as a bad idea in the past. I don't really see the point of it.<br>
</blockquote></div><br></div></div>