<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 24 July 2014 21:48, John Colvin via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<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"><div class=""><br></div>
That's a somewhat different consideration.<br>
<br>
I agree that this working might be a good thing:<br>
<br>
struct S(int n = 10)<br>
{<br>
    int a;<br>
}<br>
<br>
auto s = S(4);<br>
<br>
where the type of the struct does not depend on the type of the parameters to the constructor. However, I'm not sold that full-on implicit template instantiation should apply to members. How would we deal with this situation:<br>

<br>
struct S(T)<br>
{<br>
    this(T v) {}<br>
}<br>
<br>
auto s = S(4); //yay, compiler worked out S!int<br>
<br>
later on someone does this:<br>
<br>
struct S(T)<br>
{<br>
    this(Q v) if(is(Q : T)) {}<br>
}<br></blockquote><div><br></div><div>That doesn't make any sense though. "Q : T" is not a 1:1 relationship, so no deduction is possible there.</div><div>It makes equally little sense in the function case.</div>
<div>void f(T)(Q v) if(is(Q : T))</div><div>{</div><div>}</div><div><br></div><div>I only suggest that what would work for the function should equally work for the struct/class constructor.</div><div><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">

for whatever reason.<br>
<br>
Now all those nice constructor calls to S(someValue) are broken.<br></blockquote><div><br></div><div>Likewise if someone changed a function similarly.</div><div>I see no distinction from the function case, which I'm sure everyone agrees is perfectly good how it is?</div>
<div><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">
I dunno, somehow the implicit behaviour seems ok when it's very local but it feels dodgy at the level of separation that there can be between constructors and their types.<br>
</blockquote></div><br></div><div class="gmail_extra">Not really sure what you mean. Constructors are absolutely tied to their type, that's the point of a constructor.</div></div>