> On Oct 17, 2017, at 11:20 AM, Kevin Nattinger <sw...@nattinger.net> wrote:
> 
> Hmm, I'm not sure that would work with the covariant requirement. The 
> associated type one could:
> func firstNames<U: Unordered>(ofPeople people: U<MapResultType: Person>) -> 
> U.MapResultType<Element: String> {
>       return people.map { $0.firstName }
> }
> 
> If the sequence you put in maps to an ordered sequence, you get the ordered 
> sequence out. 
> That said, I can see how the generics there could get out-of-hand as you add 
> more operations… -> U.MapResultType.FilterResultType.MapResultType…<Element: 
> String>

Even in the simple case this leaks an implementation detail (that we’re using 
map) into the signature.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to