3 ms·
> “Purity” in Dreams logic isn’t exactly the same as “pure functions” in programming; I don’t know if functional programmers would consider any state machine to
by twobitshifter 4y ago
> “Purity” in Dreams logic isn’t exactly the same as “pure functions” in programming; I don’t know if functional programmers would consider any state machine to be “pure”. But Dreams is, at its heart, a bunch of state machines talking to each other[4]. If you want something to be reusable, keep side effects out of it.
Thoughts on this?
- masklinn 4y agoFSMs are common in functional programs though possibly informally. The FSM itself is just a function of (st, event) -> (st, value). Or possibly a bunch of st -> (st, value) functions (where each function represents an event / transition). It's a common informal way to integrate side-effects in a pure program, the impurity becomes an event or event-set over which the machine (usually composite) is integrated (via something like scan).