<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 11, 2016 at 11:56 AM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Mon Apr 11 2016, Jacob Bandes-Storch <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
<br>
> Doug wrote this in the Completing Generics manifesto, under "Minor extensions":<br>
><br>
> *Arbitrary requirements in protocols<br>
><br>
> Currently, a new protocol can inherit from other protocols, introduce new<br>
> associated types, and add new conformance constraints to associated types<br>
> (by redeclaring an associated type from an inherited protocol). However, one<br>
> cannot express more general constraints. Building on the example from<br>
> “Recursive protocol constraints”, we really want the element type of a<br>
> Sequence’s SubSequence to be the same as the element type of the Sequence,<br>
> e.g.,<br>
><br>
> protocol Sequence {<br>
> associatedtype Iterator : IteratorProtocol<br>
> …<br>
> associatedtype SubSequence : Sequence where SubSequence.Iterator.Element ==<br>
> Iterator.Element<br>
> }<br>
><br>
> +1.<br>
><br>
> To make it into Swift 3, would this feature require a proposal of its<br>
> own?<br>
<br>
</span>It could be part of another proposal, but it should be in a proposal.<br>
Whether or not it can still make Swift 3, I am unsure.<br>
<span class=""><br>
> How feasible would it be to implement on top of the current system?<br>
<br>
</span>I can't answer that, but if you want to work on this I'd suggest<br>
starting with the implementation. In this case, the proposal is the<br>
easy part.<br></blockquote><div><br></div><div>I was mostly wondering if anyone inside the team has already thought about how to do this, or perhaps even started working on it. If it's in the pipeline, it might affect our discussion about "allValues" for enums (which I'm going to send an email about soon).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Dave<br>
<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>
</font></span></blockquote></div><br></div></div>