I’ve been reading through OpenCombine to get a better understanding of the types involved with Combine. In particular I was curious how AnyPublisher is implemented. While the implementation makes a lot if sense I’m a bit lost understanding what’s happening at https://github.com/broadwaylamb/OpenCombine/blob/621f9709980350c3c63db0fa9069c2f391c8701b/Sources/OpenCombine/AnyPublisher.swift#L16. It appears to be calling init on the concrete Publisher but I guess it’s somehow actually calling AnyPublisher.init? What am I missing?
return init(self) would be calling it on the concrete Publisher (except that this syntax isn’t legal for
return .init(self), with a dot, is calling it on the type implied by the context – which in this case is the return type,
This is the same syntax as when you refer to an enum case as
.case instead of
Wow that’s very interesting, definitely a big piece that was missing from my understanding of the type system, many thanks!