[swift-evolution] [pitch] Change filter to return an associated type

Ben Cohen ben_cohen at apple.com
Sun Apr 23 15:39:46 CDT 2017


> On Apr 23, 2017, at 1:30 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> On Sun, Apr 23, 2017 at 3:12 PM, Ben Cohen <ben_cohen at apple.com <mailto:ben_cohen at apple.com>> wrote:
> 
>> On Apr 23, 2017, at 1:05 PM, Xiaodi Wu <xiaodi.wu at gmail.com <mailto:xiaodi.wu at gmail.com>> wrote:
>> 
>> Is it the intention that `associatedtype Filtered : Sequence` once recursive protocol constraints are supported?
> 
> Yup. Will add clarification.
> 
>> Can it be `associatedtype Filtered : Collection`?
>> 
> 
> Sequence.lazy.filter returns a Sequence.
> 
> 
> Ah, right. Collection can refine the associatedtype and constrain to Collection, yes?
> 

…yes, I think so. But that’s as far as we’d want to go e.g. a lazily filtered random-access collection is only bi-directional.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170423/92f9d68e/attachment.html>


More information about the swift-evolution mailing list