<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Doug,</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I've read the discussion about moving the where clause to the right of declarations (which I full-heartedly approve) but I don't see how it would have any impact on the syntax of associated types requirements.<br></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">David</div><div><br>On 12 Apr 2016, at 19:07, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 11, 2016, at 1:01 AM, Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Doug wrote this in the Completing Generics manifesto, under "Minor extensions":<div class=""><br class=""></div><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><i class="">*Arbitrary requirements in protocols<br class=""></i></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Currently, a new protocol can inherit from other protocols, introduce new associated types, and add new conformance constraints to associated types (by redeclaring an associated type from an inherited protocol). However, one cannot express more general constraints. Building on the example from “Recursive protocol constraints”, we really want the element type of a Sequence’s SubSequence to be the same as the element type of the Sequence, e.g.,<br class=""></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> protocol Sequence {<br class=""> associatedtype Iterator : IteratorProtocol<br class=""> …<br class=""> associatedtype SubSequence : Sequence where SubSequence.Iterator.Element == Iterator.Element<br class=""> }<br class=""></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">+1.</div><div class=""><br class=""></div><div class="">To make it into Swift 3, would this feature require a proposal of its own? </div></div></div></div></blockquote><div><br class=""></div><div>Yes. Also, be wary that the syntax above potentially conflicts with the syntax discussed as "moving the where clauses”:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/13886/focus=14058" class="">http://thread.gmane.org/gmane.comp.lang.swift.evolution/13886/focus=14058</a></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">How feasible would it be to implement on top of the current system?</div></div></div></div></blockquote><br class=""></div><div>Definitely! The archetype builder would need to learn to check these extra where clauses, and one would need to be sure that the constraint solver is picking them up as well.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></div><br class=""></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>