<div dir="ltr">+1 looks good to me, I also feel like this is an important bug fix. It would be nice if Swift had some kind of automatic process for type erasure that delegates all calls the the underlying implementation.<div><br></div><div>As a more concrete example for why this is important, try running these two lines in a playground:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><font face="monospace, monospace">print(Array((0...1000000000).suffix(2)))<br></font><font face="monospace, monospace">print(Array(AnySequence(0...1000000000).suffix(2)))</font></blockquote><div><font color="#333333" face="monospace"><span style="font-size:14px;background-color:rgb(245,245,245)"><br></span></font></div>The second line will take a very long time to run.<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 8, 2015 at 7:50 AM, Dmitri Gribenko 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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Dec 7, 2015 at 12:43 PM, Maxim Moiseev 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 style="word-wrap:break-word"><div>Hi all,</div><div><br></div><div>Here is the proposal to add more constraints to AnySequence.init in order to implement delegation of method calls to the underlying SequnceType implementation.</div><div><a href="https://github.com/moiseev/swift-evolution/blob/restricted-anyseq/proposals/0008-constrained-AnySequence.md" target="_blank">https://github.com/moiseev/swift-evolution/blob/restricted-anyseq/proposals/0008-constrained-AnySequence.md</a></div><div><br></div><div>(Including full text of the proposal at the bottom for your convenience).</div><div><br></div><div>Final goal would be to eventually properly delegate all the calls to `SequenceType` and `CollectionType` methods inside `AnySequence` and `Any${Traversal}Collection`.</div></div></blockquote><div><br></div></span><div>Thanks, Max!</div><div><br></div><div>I reviewed this proposal with Max offline and it LGTM. The biggest question that we have to answer is if this change is small enough to be included in Swift 2.2. I would say yes, since the only collections that are affected by this change are collections that we don't consider valid, where the author went an extra mile to declare an improper SubSequence type -- and they would stop working anyway once we can constrain the SubSequence the way we want.</div><div><br></div><div>What does everyone think?</div><div><br></div><div>Dmitri</div></div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div>main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>>*/</div>
</font></span></div></div><span class="HOEnZb"><font color="#888888">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=pQw7h83fWt3LLbgkfL4TSUL0weaZnVFZxDe5GShw4uTD-2F5YA2cPTAG19oaMMRhB9cOrDst2AhTog0rJxDc2y5DdazImTDidfgeNnTrNRkKD51TmzMsaWCnZR5amZt8AWzzxzFMQz3OTjt-2B98D6h1p3Y-2B2AYb6oF5WWUSSh0JwC78n74rRN4uOwOj-2BxvrUjak8wBVbWlFP2C7sIPa67AvhGqRSL0MMxvYp-2B02NZcYSeo-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</font></span><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>
<br></blockquote></div><br></div>