<div dir="ltr">Thank you for the kind comments and the review, Dave! I will be working to address the points you brought up throughout the week. This will include re-auditing the stdlib types based on both manual investigation and Doug&#39;s branch.<div><br></div><div>Anyone who wants to help, by the way, is more than welcome to; I&#39;m happy to take PRs or just even a message describing what needs to change, and I&#39;d of course add you to the authors list...<br><div><br></div><div>Regarding &quot;valid&quot; recursive constraints breaking the compiler: it was a reference to something Doug said in his original email:</div><div><br></div><div>&gt; <span style="font-size:12.8px">I also have a nagging feeling that we will need some form of restrictions on this feature for implementation reasons, e.g., because some recursive constraints will form unsolvable systems.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Best,</span></div><div><span style="font-size:12.8px">Austin</span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 31, 2016 at 11:29 AM, Dave Abrahams 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"><span class=""><br>
on Sat Dec 31 2016, Dave Abrahams &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br>
<br>
&gt; on Fri Dec 30 2016, Austin Zheng &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; After overpromising and underdelivering, I finally managed to sit down<br>
&gt;&gt; and draft a proposal. Sorry it took so long.<br>
&gt;<br>
&gt; All your help is deeply appreciated, Austin!<br>
&gt;<br>
&gt;&gt; You can find it here:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt; <a href="https://github.com/austinzheng/swift-evolution/blob/recursive-constraints/proposals/XXXX-recursive-protocol-constraints.md" rel="noreferrer" target="_blank">https://github.com/<wbr>austinzheng/swift-evolution/<wbr>blob/recursive-constraints/<wbr>proposals/XXXX-recursive-<wbr>protocol-constraints.md</a><br>
&gt;&gt;<br>
&gt; &lt;<a href="https://github.com/austinzheng/swift-evolution/blob/recursive-constraints/proposals/XXXX-recursive-protocol-constraints.md" rel="noreferrer" target="_blank">https://github.com/<wbr>austinzheng/swift-evolution/<wbr>blob/recursive-constraints/<wbr>proposals/XXXX-recursive-<wbr>protocol-constraints.md</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; It contains both a description of the change itself, as well as a list<br>
&gt;&gt; of stdlib changes that need to be made. I used the “FIXME(ABI)”<br>
&gt;&gt; comments in the codebase to compile that list of changes. I also went<br>
&gt;&gt; over parts of the stdlib myself to see if there was anything else I<br>
&gt;&gt; could find, but didn’t notice anything in particular. (I was hoping<br>
&gt;&gt; protocols like `_Integer` could go away, but I’m not sure the issue<br>
&gt;&gt; they’re working around is related to recursive constraints.)<br>
&gt;<br>
&gt; It is.<br>
&gt;<br>
&gt;&gt; One thing that needs to be done before this can enter formal review is<br>
&gt;&gt; thinking through cases where “valid” recursive constraints might break<br>
&gt;&gt; the compiler.<br>
&gt;<br>
&gt; I haven&#39;t read it yet; does the document explain what you mean by that?<br>
&gt; Because it&#39;s not obvious from this message<br>
<br>
</span>...or from the document.<br>
<br>
I left some commentary in<br>
<a href="https://github.com/austinzheng/swift-evolution/commit/ad1d28b3b74bb12cfd07c277322ea4eb2b78b8cd#diff-6b60459047bfe1c675c50d5ca66cfe91R57" rel="noreferrer" target="_blank">https://github.com/<wbr>austinzheng/swift-evolution/<wbr>commit/<wbr>ad1d28b3b74bb12cfd07c277322ea4<wbr>eb2b78b8cd#diff-<wbr>6b60459047bfe1c675c50d5ca66cfe<wbr>91R57</a><br>
<br>
in addition, I notice that many of the likely stdlib changes are<br>
missing... but it may be more efficient for you to watch the branch<br>
Doug&#39;s working on and see what changes are made there, and then propose<br>
those, than to try to anticipate what will change.<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;&gt; Help on that (or any other feedback, really) would be greatly<br>
&gt;&gt; appreciated.<br>
&gt;&gt;<br>
&gt;&gt; Best,<br>
&gt;&gt; Austin<br>
&gt;&gt;<br>
&gt;&gt;&gt; On Nov 21, 2016, at 6:42 PM, Austin Zheng &lt;<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Never mind, I just saw SE-0142. I need to go back and read all the proposals again!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Mon, Nov 21, 2016 at 6:32 PM, Austin Zheng<br>
&gt;&gt;&gt; &lt;<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a><br>
&gt;&gt;&gt; &lt;mailto:<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a>&gt;<wbr>&gt; wrote:<br>
&gt;&gt;&gt; I&#39;m still working on this. When you mention where clauses on<br>
&gt;&gt;&gt; associated types, how should I handle that in the context of the<br>
&gt;&gt;&gt; proposal?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Consider where clauses part of the proposal (so that the proposal<br>
&gt;&gt;&gt; becomes &quot;recursive associated type constraints + where clauses on<br>
&gt;&gt;&gt; associated types&quot;)<br>
&gt;&gt;&gt; * Assume that where clauses will definitely be accepted, and write the stdlib changes assuming that<br>
&gt;&gt;&gt; * Assume that where clauses might not be accepted, and write the<br>
&gt;&gt;&gt; stdlib changes assuming that, but also have a section containing<br>
&gt;&gt;&gt; further stdlib changes conditional on where clauses being accepted<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Best,<br>
&gt;&gt;&gt; Austin<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sun, Nov 13, 2016 at 7:55 PM, Douglas Gregor<br>
&gt;&gt;&gt; &lt;<a href="mailto:dgregor@apple.com">dgregor@apple.com</a><br>
&gt;&gt;&gt; &lt;mailto:<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Nov 13, 2016, at 4:03 PM, Austin Zheng<br>
&gt;&gt;&gt; &lt;<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a><br>
&gt;&gt;&gt; &lt;mailto:<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a>&gt;<wbr>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I&#39;d be happy to put something together, unless someone else wants to take it on.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Great, thanks!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Doug, I also owe you a PR adding a minor amendment to one of the<br>
&gt;&gt;&gt;&gt; accepted proposals. I&#39;ll get to that this week.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sounds great.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;   - Doug<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Austin<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Sun, Nov 13, 2016 at 10:13 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.<wbr>org</a>&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt; Recursive protocol constraints is one small-looking feature that could greatly improve the standard library. The generics manifesto describes it this way:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; &quot;Currently, an associated type cannot be required to conform to its enclosing protocol (or any protocol that inherits that protocol). For example, in the standard library SubSequence type of a Sequence should itself be a Sequence:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; protocol Sequence { associatedtype Iterator : IteratorProtocol ... associatedtype SubSequence : Sequence // currently ill-formed, but should be possible }<br>
&gt;&gt;&gt;&gt; The compiler currently rejects this protocol, which is unfortunate: it effectively pushes the SubSequence-must-be-a-Sequence requirement into every consumer of SubSequence, and does not communicate the intent of this abstraction well.&quot;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;  &lt;<a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#nested-generics" rel="noreferrer" target="_blank">https://github.com/apple/<wbr>swift/blob/master/docs/<wbr>GenericsManifesto.md#nested-<wbr>generics</a>&gt;It&#39;s actually slightly worse than the above implies: the standard library has a pile of underscore-prefixed protocols (e.g., _Sequence) specifically to dodge this restriction. They are ugly, and we want them to go away. Many of these places are marked with an ABI FIXME in the standard library sources.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Would someone like to write up a proposal for this feature? The syntax and basic semantics are pretty direct, but a proposal should also capture the expected effects on the standard library, particularly when combined with where clauses on associated types.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I also have a nagging feeling that we will need some form of restrictions on this feature for implementation reasons, e.g., because some recursive constraints will form unsolvable systems.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; For reference, we&#39;ve already been implementing this feature. Some information about the compiler internal issues is captured at:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;   <a href="https://gist.github.com/DougGregor/e7c4e7bb4465d6f5fa2b59be72dbdba6" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>DougGregor/<wbr>e7c4e7bb4465d6f5fa2b59be72dbdb<wbr>a6</a> &lt;<a href="https://gist.github.com/DougGregor/e7c4e7bb4465d6f5fa2b59be72dbdba6" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>DougGregor/<wbr>e7c4e7bb4465d6f5fa2b59be72dbdb<wbr>a6</a>&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;   - Doug<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt;&gt;&gt; swift-evolution mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.<wbr>org</a>&gt;<br>
&gt;&gt;&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
&gt;&gt; &lt;<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a>&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; swift-evolution mailing list<br>
&gt;&gt; <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
&gt;&gt;<br>
<br>
--<br>
-Dave<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</div></div></blockquote></div><br></div>