Reactive Programming
Stijn Mostinckx and Andoni Lombide Carreton
AmbientTalk/R
Distributed Semantics
Up to this point, reactive values – and the dataflow networks constructed using them – have been confined to the scope of a single actor. At present, we are experimenting with two mechanisms to allow dataflow dependencies to cross the actor boundary. Both techniques are briefly described below.
Contagion of Asynchronous Messages
One mechanism to allow dataflow graphs to span multiple actors is to require that the contagion semantics apply to asynchronous messages as well as synchronous method invocations. Hence, when reactive values are passed as arguments to an asynchronous message send, that operation is lifted by the interpreter.
Instead of sending the message as is, a snapshot message is sent in which all reactive values are replaced with their current snapshot value. Subsequent updates to the reactive arguments of the lifted message result in new snapshot messages being sent.
Ambient Behaviors
Ambient behaviors allow reactive values to be published using a dedicated exportBehavior:as:
construct. Reactive values that have been exported as such can be discovered using a specialized variant of ambient references: an ambient behavior.
The goal of these abstractions is to allow programmers to explicitly construct a distributed dependency graph, without having to encode that graph in patterns of message sending.
Further Reading
- Reactive Context-Aware Programming, a programming paradigm for the Internet of Things, which integrates reactive programming support with pattern matching rules to provide applications with a window on the world.