[swift-evolution] restricting AnySequence.init

Dmitri Gribenko gribozavr at gmail.com
Mon Dec 7 14:50:00 CST 2015


On Mon, Dec 7, 2015 at 12:43 PM, Maxim Moiseev via swift-evolution <
swift-evolution at swift.org> wrote:

> Hi all,
>
> Here is the proposal to add more constraints to AnySequence.init in order
> to implement delegation of method calls to the underlying SequnceType
> implementation.
>
> https://github.com/moiseev/swift-evolution/blob/restricted-anyseq/proposals/0008-constrained-AnySequence.md
>
> (Including full text of the proposal at the bottom for your convenience).
>
> Final goal would be to eventually properly delegate all the calls to
> `SequenceType` and `CollectionType` methods inside `AnySequence` and
> `Any${Traversal}Collection`.
>

Thanks, Max!

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.

What does everyone think?

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151207/7129dc1a/attachment.html>


More information about the swift-evolution mailing list