AsyncSequence, break, and cancellation

Thank you for the reference. it puzzle me a lot that Combine don't have a detailed specification. Yet I still have questions.

Combine does have some seemingly obscure and inconsistent rules, like subscription.request(.none). But to me deinit and cancel are very clear and consistent. Every Subscriber and inner subscriber in an operator appear to follow the same rule of Subscriber:

  1. When you receive a unneeded Subscription, cancel it and drop it.
  2. If you don't need a Subscription anymore, cancel it before nil it out.
  3. Never manually cancel a Subscription on deinit.

The only place I see cancel on deinit is AnyCancellable, CurrentValueSubject and PassthroughSubject. They are not Subscriber however.

Therefore, I don't expect AsyncPublisher.Iterator.Inner (which is a Subscriber) to cancel its Subscription on deinit. Am I missing something?

Terms of Service

Privacy Policy

Cookie Policy