> Better support for existentials (see the generics manifesto, > https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md) should > obviate the need for any sort of sugar or compiler magic to do this kind of > thing. > > typealias AnyCollection<T> = Any<Collection where .Element == T, ...> > func doSomething(collection: AnyCollection<Foo>)
That isn't really the same thing, though. Any<Collection> is an existential; it introduces indirection which would not be present in the generic version and, in this case, it erases several associated types, potentially introducing type-unsafety as well. -- Brent Royal-Gordon Architechies _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution