<div dir="ltr">I'd be interested in taking it but I have another ticket already, so if someone else wants it they should take it.<div><br></div><div>Austin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 2:35 PM, Dmitri Gribenko <span dir="ltr"><<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Dec 7, 2015 at 2:27 PM, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com">jtbandes@gmail.com</a>> wrote:<br>
> What do you mean by "without copying the underlying collection"?<br>
<br>
</span>The original collection should be preserved through this upgrade, and<br>
not, say, copied into a fresh Array.<br>
<span class=""><br>
> Is this<br>
> specifically for the case where the AnySequence is wrapping a collection<br>
> (which is not always the case)?<br>
<br>
</span>Exactly.<br>
<div class="HOEnZb"><div class="h5"><br>
Dmitri<br>
<br>
> On Mon, Dec 7, 2015 at 2:18 PM, Dmitri Gribenko via swift-dev<br>
> <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br>
>><br>
>> It would require a proposal and a review, but the implementation is<br>
>> more challenging here than the API design. The proposal would be<br>
>> trivial, just one extra API, if I'm imagining this correctly.<br>
>><br>
>> Dmitri<br>
>><br>
>> On Mon, Dec 7, 2015 at 2:10 PM, Austin Zheng <<a href="mailto:austinzheng@gmail.com">austinzheng@gmail.com</a>><br>
>> wrote:<br>
>> > Would this require a review/proposal, since it involves an API change?<br>
>> ><br>
>> > On Mon, Dec 7, 2015 at 2:08 PM, Dmitri Gribenko via swift-dev<br>
>> > <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br>
>> >><br>
>> >> Hi,<br>
>> >><br>
>> >> If someone looks for a starter project in the standard library with<br>
>> >> intermediate complexity (prior experience with Swift generics<br>
>> >> required), here's one.<br>
>> >><br>
>> >> This is in the area of existential sequence and collection wrappers.<br>
>> >><br>
>> >> Upgrading AnyForwardCollection to AnyRandomAccessCollection works:<br>
>> >><br>
>> >> (swift) AnyRandomAccessCollection(AnyForwardCollection([1,2,3]))<br>
>> >> // r2 : AnyRandomAccessCollection<Int>? =<br>
>> >> Optional(Swift.AnyRandomAccessCollection<Swift.Int>(_box:<br>
>> >> Swift._CollectionBox<Swift.Array<Swift.Int>>))<br>
>> >><br>
>> >> Seems like we don't provide APIs to upgrade AnySequence to<br>
>> >> Any*Collection:<br>
>> >><br>
>> >> (swift) AnyRandomAccessCollection(AnySequence([1,2,3]))<br>
>> >> <REPL Input>:1:1: error: cannot invoke initializer for type<br>
>> >> 'AnyRandomAccessCollection<_>' with an argument list of type<br>
>> >> '(AnySequence<Int>)'<br>
>> >><br>
>> >> Of course, this should work without copying the underlying collection.<br>
>> >><br>
>> >> <a href="https://bugs.swift.org/browse/SR-119" rel="noreferrer" target="_blank">https://bugs.swift.org/browse/SR-119</a><br>
>> >><br>
>> >> Dmitri<br>
>> >><br>
>> >> --<br>
>> >> 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">gribozavr@gmail.com</a>>*/<br>
>> >> _______________________________________________<br>
>> >> swift-dev mailing list<br>
>> >> <a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
>> >> <a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br>
>> ><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> 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">gribozavr@gmail.com</a>>*/<br>
>> _______________________________________________<br>
>> swift-dev mailing list<br>
>> <a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
>> <a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
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">gribozavr@gmail.com</a>>*/<br>
</div></div></blockquote></div><br></div>