<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">Just a heads-up that I’ve been working on the implementation of&nbsp;<a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#recursive-protocol-constraints-" class="">recursive protocol constraints</a>&nbsp;in master. For reference, this will eventually lead to allowing, e.g.,</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol Sequence {</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; associatedtype SubSequence: Sequence</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></div><div class=""><br class=""></div><div class="">and similar, which will be a major simplification for the Swift standard library. There are a *lot* of places in the Swift compiler where we assume that we can enumerate the complete set of nested types from a type parameter, e.g., if S is a Sequence then we try to enumerate S.SubSequence, S.SubSequence.SubSequence, S.SubSequence.SubSequence.SubSequence, which will end badly.&nbsp;</div><div class=""><br class=""></div><div class="">To implement recursive protocol constraints, we need to find and eliminate all of these assumptions in the compiler. I’ve put up a gist here cataloging the ones I know about:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://gist.github.com/DougGregor/e7c4e7bb4465d6f5fa2b59be72dbdba6" class="">https://gist.github.com/DougGregor/e7c4e7bb4465d6f5fa2b59be72dbdba6</a></div><div class=""><br class=""></div><div class="">The goal is to reduce this gist to nothing as we eliminate these assumptions. If you know of any other places that make such assumptions, please tell me!</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""></div></body></html>