We have many type erasure classes like AnyPublisher
in Combine
framework. But why do need them at all, as we already have parameterized protocols?
For example, why don’t we just replace let myPublisher = AnyPublisher<Int, Never>
with any Publisher<Int, Never>
? The only difference I can tell is that type erasure gives us existential types, but why do we care?