I also think that actors and signals have to be designed together: E.g. how would you subscribe in your actor to a signal defined in another actor so that it is thread safe. I could imagine that the signals used in actors are actors themselves ( maybe sharing the execution context of their containing actor if this is deemed to be inefficient - which should not be the case) Cheers Marc
Comments in-line below. On Sun, 24 Sep 2017 at 12:36 pm, Matt Gallagher via swift-evolution <swift-evolution@swift.org> wrote: Some thoughts as a programmer who has written an atypical reactive programming library... ReactiveX can be built upon Reactive Streams, e.g. RxJava 2.0., but the idea of Reactive Streams is that the protocol is so low level you don’t interact directly with them. They seem compatible with many different styles including actors, e.g. Akka (the Akka people destined Reactive Streams I think). Reactive Streams are very actor like with one way communication links that transfer a copy of single items/errors or no items/error (pure messages).
Nothing in the Reactive Stream specification to prevent single use Publishers, Subscribers, or Processors. The Reactive Stream specification only talks about the communication and error reporting. As long as your library has the concept of a subscription of some form you can probably write translators to the 3 protocols.
Seems to work OK in the Java world, people use Akka and RxJava together.
This is what Reactive Streams are. They just tell you how to hook things up, how to ask for items, how to report errors, and how to finish with a connection. They do not dictate the semantics at the other end. For example your translator could throw fatal exception on an error if your library didn’t report errors or wrap the error in a Result type if it handled error in a functional way.
As I have said they are very actor like and I think it was the Akka people who came up with the specification therefore I am not sure you are locking anything out. If the Swift actor model can’t interact with something as simple as Reactive Streams it will not interact with anything other than other Swift Actors, which would be very limiting. For example you would expect the Swift actors to interact with GCD, perhaps via suitable wrappers.
I would prefer to move forward more quickly, I don’t think there is much risk since the specification is so low level and flexible. The whitpaper from Chris Lattner also mentions that it would be desirable for any Actor system in Swift to be compatible with Reactive Streams, so why not start now.
-- -- Howard.
|
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution