<div dir="ltr">I'm interested, but I'm by no means claiming I'll have enough time to drive any of the discussion/proposal/implementation. :-(<div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Tue, Apr 12, 2016 at 3:07 PM, 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"><div class="HOEnZb"><div class="h5"><br>
on Tue Apr 12 2016, Douglas Gregor <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
<br>
> On Apr 11, 2016, at 1:01 AM, Jacob Bandes-Storch via swift-evolution<br>
> <<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<br>
> extensions":<br>
><br>
> *Arbitrary requirements in protocols<br>
><br>
> Currently, a new protocol can inherit from other protocols, introduce<br>
> new associated types, and add new conformance constraints to associated<br>
> types (by redeclaring an associated type from an inherited protocol).<br>
> However, one cannot express more general constraints. Building on the<br>
> example from “Recursive protocol constraints”, we really want the<br>
> element type of a Sequence’s SubSequence to be the same as the element<br>
> type of the Sequence, 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 own?<br>
><br>
> Yes. Also, be wary that the syntax above potentially conflicts with the syntax<br>
> discussed as "moving the where clauses”:<br>
><br>
> <a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/13886/focus=14058" rel="noreferrer" target="_blank">http://thread.gmane.org/gmane.comp.lang.swift.evolution/13886/focus=14058</a><br>
><br>
> How feasible would it be to implement on top of the current system?<br>
><br>
> Definitely! The archetype builder would need to learn to check these extra where<br>
> clauses, and one would need to be sure that the constraint solver is picking<br>
> them up as well.<br>
<br>
</div></div>By the way, having this would enable us to massively simplify the<br>
standard library, and potentially lots of user-written generic code,<br>
too. So I'm very excited that someone's interested!<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Dave<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div></div>