[swift-evolution] [Review] SE-0174: Change `filter` to return an associated type

Xiaodi Wu xiaodi.wu at gmail.com
Wed May 3 00:37:18 CDT 2017


Not an author, but I asked Ben a similar question during the pitch to one
of yours.

He clarified that the intention was to constrain Filtered to Sequence once
recursive constraints are implemented. Collection will refine to constrain
Filtered to Collection, and Ben said that this was about as far as he was
willing to go in terms of successive refinements.
On Wed, May 3, 2017 at 00:33 Brent Royal-Gordon via swift-evolution <
swift-evolution at swift.org> wrote:

> On Apr 28, 2017, at 5:06 PM, Douglas Gregor via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>
>    - What is your evaluation of the proposal?
>
> I'm in favor of this proposal, and I don't agree with the previous
> reviewers who think this should be coupled with more advanced type system
> features. However, I have a few questions:
>
> * How will associated type inference interact with this? If you write a
> type-specific `filter`, will it be automatically favored over the `Array`
> version, or will you have to manually specify a `Filtered` typealias?
>
> * Do we want to constrain `Filtered` to `Sequence` or `Collection`? Do we
> want to require `where Filtered.Iterator.Element == Self.Iterator.Element`?
>
> * Will `AnySequence`/`AnyCollection` have a `Filtered` of type
> `AnySequence`/`AnyCollection`, or one of type `Array`?
>
> No time for a full review, but I thought it'd be helpful to note these
> things before the review period was up.
>
> --
> Brent Royal-Gordon
> Architechies
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170503/8c1e8822/attachment.html>


More information about the swift-evolution mailing list