Open ghost opened 7 years ago
cedar
definitely needs an "effects system." Currently, there isn't good support for mutation/side effects, as all properties are referentially transparent. Although, side effects can be achieved through Update
(which is currently &mut self
) or interior mutability, an effects system would be the suggested method.
An interesting question: what would subscriptions and commands look like in cedar
(i.e. rust)?
cedar
enables us to create GUI apps with our favorite backend, but there is a core/runtime component that enables us to easily build using the cedar
architecture: define a model, define messages, declare a view hierarchy signaled by updates, etc. A key piece of this runtime is the reactor, which dispatches those messages.
Properties declared in the view are modeled as signals of the model. The view is declarative, but the value of a property continuously varies over time. To mesh with the functional-reactive design, commands can be modeled as asynchronous futures, subscriptions as asynchronous streams. A runtime reactor handles the execution of these and dispatches the generated messages (which will trigger updates to the model).
Of course, I'm writing this without having tried to prototype this design yet, so fingers crossed.
Elm has support for subscriptions and commands, which used to be effects in the last version. Choo also has this. Should cedar have something similar?
EDIT: just saw this on the project board. I'd still love to discuss how we approach this issue.