reflex-frp / reflex

Interactive programs without callbacks or side-effects. Functional Reactive Programming (FRP) uses composable events and time-varying values to describe interactive systems as pure functions. Just like other pure functional code, functional reactive code is easier to get right on the first try, maintain, and reuse.

Home Page:https://reflex-frp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sampling and async performEvent are incompatible

mpickering opened this issue · comments

The core of my application is built around a rule type which is essentially an IO action with the ability to sample dynamics. As the IO action runs it samples different dynamics depending on what the rule is.

Unfortunately all these actions have to run in the same thread as given the current implementation of performEventAsync the action must only be of type IO.

However, I believe it should be safe to sample a Dynamic from a different thread because sampling is just a read of the variable. This idea could already be implemented by sampling every dynamic in my program before passing a record of all the sampled values into the function. This is undesirable though and typically each rule is not using most of the Dynamics.