<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi.<div class=""><br class=""></div><div class="">I was looking to implement <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0174-filter-range-replaceable.md" class="">SE-0174</a> (Change filter to return an associated type) but noticed that a different <font face="Menlo" style="font-size: 11px;" class="">RangeReplaceableCollection.filter</font> implementation had already been added in <font face="Menlo" style="font-size: 11px;" class="">fd2ac31</font> to make <font face="Menlo" style="font-size: 11px;" class="">String.filter</font> return a <font face="Menlo" style="font-size: 11px;" class="">String</font>.</div><div class=""><div class=""><br class=""></div></div><div class="">The <font face="Menlo" style="font-size: 11px;" class="">RangeReplaceableCollection.filter</font> implementation in SE-0174 eagerly enumerates <font face="Menlo" style="font-size: 11px;" class="">self</font> to filter its elements:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="font-size: 11px;" class=""><font face="Menlo" class="">var result = Self() </font></div><div style="font-size: 11px;" class=""><font face="Menlo" class="">for element in self { </font></div><div style="font-size: 11px;" class=""><font face="Menlo" class=""> if try isIncluded(element) {</font></div><div style="font-size: 11px;" class=""><div class=""><font face="Menlo" class=""> result.append(element)</font></div></div><div style="font-size: 11px;" class=""><div class=""><font face="Menlo" class=""> }</font></div></div><div style="font-size: 11px;" class=""><div class=""><font face="Menlo" class="">} </font></div></div><div style="font-size: 11px;" class=""><font face="Menlo" class="">return result</font></div></blockquote><div class=""><br class=""></div><div class="">whereas the current implementation creates <font face="Menlo" style="font-size: 11px;" class="">Self</font> from a lazy filter:</div><div class=""> </div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="font-size: 11px;" class=""><font face="Menlo" class="">return try Self(self.lazy.filter(isIncluded))</font></div></blockquote><div class=""><br class=""></div><div class="">Which of these implementations is preferred for SE-0174?</div><div class=""><br class=""></div><div class="">The intended behavior of SE-0174 is already there with <font face="Menlo" style="font-size: 11px;" class="">Data</font>, <font face="Menlo" style="font-size: 11px;" class="">Set</font>, <font face="Menlo" style="font-size: 11px;" class="">String</font>, etc. returning <font face="Menlo" style="font-size: 11px;" class="">Self</font> when filtered. As far as I can tell the only remaining work is to add the associated type and specify the type alias in a few places to disambiguate which implementation is used to satisfy the Sequence protocol, essentially making this a non functional change. Or am I missing something? </div><div class=""><br class=""></div><div class="">Regards,</div><div class="">David</div></body></html>