<div style="white-space:pre-wrap"><br>ConstructibleFromValue&lt;ValueType == V&gt;<br><br>Sounds way better to me than the second option considering we can&#39;t do just<br><br>ConstructibleFromValue&lt;V&gt;<br><br>Because of lack of order of associated types. So IMO either we introduce order or we use == syntax. Maybe somebody has more ideas of a better syntax?</div><br><div class="gmail_quote"><div dir="ltr">On Tue, 6 Dec 2016 at 11:33 Anton Zhilin via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="m_2356099523461971695markdown-here-wrapper gmail_msg"><p style="margin:0px 0px 1.2em!important" class="gmail_msg">What makes me worry is if this syntax is really the best one possible:</p></div></div><div dir="ltr" class="gmail_msg"><div class="m_2356099523461971695markdown-here-wrapper gmail_msg">
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="m_2356099523461971695hljs m_2356099523461971695language-swift gmail_msg" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">typealias</span> <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">ConstructibleFrom</span>&lt;<span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">V</span>&gt; = <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">ConstructibleFromValue</span> <span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">where</span> <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">ValueType</span> == <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">V</span>
</code></pre>
</div></div><div dir="ltr" class="gmail_msg"><div class="m_2356099523461971695markdown-here-wrapper gmail_msg"><p style="margin:0px 0px 1.2em!important" class="gmail_msg">I find it strange that such exact line with <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">typealias</code> and <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">where</code> is required. I was hoping for an expression that lets us specialize a protocol and use it in-place, like so:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="m_2356099523461971695hljs m_2356099523461971695language-swift gmail_msg" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="m_2356099523461971695hljs-class gmail_msg"><span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">extension</span> <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">MyType</span> : <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">ConstructibleFromValue</span>&lt;<span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">ValueType</span> == <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">V</span>&gt;
<span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">extension</span> <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">MyType</span> : (<span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">ConstructibleFromValue</span> <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">where</span> <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">ValueType</span> == <span class="m_2356099523461971695hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">V</span>)</span>
</code></pre>
<p style="margin:0px 0px 1.2em!important" class="gmail_msg">Also I thought that this topic does not really belong to generalized existentials:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="m_2356099523461971695hljs m_2356099523461971695language-swift gmail_msg" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">var</span> x: <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">ConstructibleFrom</span>&lt;<span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Float</span>&gt;
</code></pre>
<p style="margin:0px 0px 1.2em!important" class="gmail_msg">I mean, we specify all the types here, so the compiler should just specialize the protocol and use it as a normal existential. The only thing that does not allow us to do that now is syntax.<br class="gmail_msg">By comparison, the following <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">typealias</code> does require generalized existentials, because some <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">associatedtype</code>s, including <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">Iterator</code>, are not specified:</p></div></div><div dir="ltr" class="gmail_msg"><div class="m_2356099523461971695markdown-here-wrapper gmail_msg">
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="m_2356099523461971695hljs m_2356099523461971695language-swift gmail_msg" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">typealias</span> <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">GenericCollection</span>&lt;<span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">E</span>&gt; = <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Collection</span> <span class="m_2356099523461971695hljs-keyword gmail_msg" style="color:rgb(51,51,51);font-weight:bold">where</span> <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Iterator</span>.<span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Index</span> == <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Int</span>, <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">Element</span> == <span class="m_2356099523461971695hljs-type gmail_msg" style="color:rgb(68,85,136);font-weight:bold">E</span>
</code></pre>
</div></div><div dir="ltr" class="gmail_msg"><div class="m_2356099523461971695markdown-here-wrapper gmail_msg"><p style="margin:0px 0px 1.2em!important" class="gmail_msg">It also shows that future generalized-existentials syntax will likely be exactly the same as the one we choose now for protocol specialization.<br class="gmail_msg">So we still should think twice before proceeding. We can implement this proposal now, but do we want to?</p>
<div title="MDH:V2hhdCBtYWtlcyBtZSB3b3JyeSBpcyBpZiB0aGlzIHN5bnRheCBpcyByZWFsbHkgdGhlIGJlc3Qg
b25lIHBvc3NpYmxlOjxkaXY+PGJyPjwvZGl2PjxkaXY+YGBgc3dpZnQ8L2Rpdj48ZGl2PnR5cGVh
bGlhcyBDb25zdHJ1Y3RpYmxlRnJvbSZsdDtWJm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g">​</div></div></div>
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>