How does Effect differ from Publisher?

Speculating, I see three reasons:

  • They can add members to Effect without risking collisions with current or future Publisher APIs.

  • They can add initializers to Effect. For example, you can say Effect(value: 123). Since Publisher is a protocol, you cannot call an initializer directly on it. You cannot define an init that lets you say Publisher(value: 123). Instead you have to use a conforming type like Just(123).

  • They can add static members to Effect and you can refer to them with dot-syntax. For example, you can say .none or .future(...) or .result(...) in a context where the type is deduced as Effect. You cannot use dot-syntax to create a Publisher, even in a context where the type is deduced as conforms-to-Publisher.

1 Like