<div dir="ltr">Big +1 on this proposal from me.<div><br></div><div>Does this proposal allow a protocol can have generic associated types?<div><ul><li><span style="font-family:monospace,monospace">associatedtype Something&lt;T&gt;</span><br></li><li><span style="font-family:monospace,monospace">associatedtype Something&lt;T: Hashable&gt;</span></li></ul></div></div>It&#39;s not mentioned, but I think it would be necessary at some point for completeness.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 17, 2016 at 2:32 PM, Joe Groff via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<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"><span class=""><br><div><blockquote type="cite"><div>On Mar 16, 2016, at 5:02 PM, Chris Lattner &lt;<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">On Mar 16, 2016, at 4:56 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt; wrote:<br><div><blockquote type="cite"><div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">We shouldn’t infer it the requirement.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Rationale: I see this as analogous (in two ways) to why we don’t infer hashability of T in:</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">func f&lt;T&gt;(…) {</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">  let x : Dictionary&lt;T, String&gt;</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">}</div></div></blockquote><div><br></div><div>However, we do infer the `T: Hashable` in a case like this:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>func foo&lt;T&gt;(x: Dictionary&lt;T, String&gt;) {}</div><div><br></div></div></blockquote>`typealias` feels similar to that to me. It doesn&#39;t have to be a global analysis, just an analysis of the RHS of the typealias.</div></div></blockquote><br></div><div>I consider the RHS of the typealias to be the “body” of the type alias, and parameters to be part of the “signature” of the funcdecl.</div></div></div></blockquote><br></div></span><div>I&#39;m OK starting with the base design that constraints have to be explicit. My gut tells me though that `typealias` is close enough syntactically to `var` that many people will expect the inference to occur, but we can always add it later.</div><div><br></div><div>-Joe</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>