<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div style="direction: inherit;">Isn't the solution to a lot of these issues allowing explicit generalization instead of this meta type business?</div></div><div><br>On 22 Jul 2016, at 17:03, Anton Zhilin via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-07-22 17:32 GMT+03:00 Karl <span dir="ltr">&lt;<a href="mailto:razielim@gmail.com" target="_blank">razielim@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I wouldn’t be surprised if there are less than a handful of people outside of the Swift team who understand what .Protocol means.&nbsp;</div><div><br></div><div>Most of us just want to create generic objects based on their conformance to an initialiser in a protocol:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>protocol Constructable {</div><div><span style="white-space:pre-wrap">        </span>init()</div><div>}</div><div><br></div><div>func construct&lt;C:Constructable&gt;() -&gt; C {</div><div><span style="white-space:pre-wrap">        </span>return C() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // ERROR</div><div>}</div></blockquote></div></blockquote><div><br></div><div>In your example, there is no problem, because we can disambiguate based on return type:</div><div><br></div><div>let c = construct() as SomeConstrictible</div><div><br></div><div>Metatypes are only really needed, when target type would not appear in the signature otherwise.</div><div>And I kind-of understand the decision of not adding explicit generic function specialization, because otherwise there would be double specialization in generic constructors, like this:</div><div><br></div><div>struct Example&lt;T&gt; {</div><div>&nbsp; &nbsp; init&lt;U&gt;()</div><div>}</div><div>Example&lt;Int&gt;&lt;Double&gt;</div><div><br></div><div>And that would look awful. If I'm not mistaken, such initializers exist in the standard library.</div></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>