ztellman / automat

better automata through combinators
588 stars 50 forks source link

timeout example #36

Closed happy-lisper closed 7 years ago

happy-lisper commented 8 years ago

While I think I know how I would do that (via reducer functions), I am looking for a recommendation how to achieve timeout transitions.

happy-lisper commented 8 years ago

optimally, timeout supports would be in the library though

ztellman commented 8 years ago

The automata advancement doesn't block, I'm not sure how a timeout would fit into the library. Typically a timeout would be a signal, which may or may not be a valid signal depending on whether the event has already occurred.

happy-lisper commented 8 years ago

I realize that an automata advancement does not block, and of course timers would be managed outside of the library. However, in my case, I deal with different timeouts for different states and have a need to somehow create those timers, e.g. using overtone/at-at and manage them depending on states. Also, in case the timer does not trigger, I need to be able to cancel it. In some cases I might need to set two timers causing different signals, one longer for entire operation, another shorter for some sub-state. In another words, I need to tell what state I am in, and in that sense I would need a support from the library. I initially though to use reducer functions, but now see it will not work.

ztellman commented 7 years ago

Closing, as this is out of scope for this library.