[swift-evolution] [Draft] Rename Sequence.elementsEqual
Adam Kemp
adam_kemp at apple.com
Tue Oct 17 13:25:54 CDT 2017
> On Oct 17, 2017, at 11:20 AM, Kevin Nattinger <swift at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171017/9a90d7e3/attachment.html>
More information about the swift-evolution
mailing list