4 ms·
All I know is, the parts of my app that I implemented with state machines are by far the most stable, least buggy. fwiw, if xstate feels like too much for what
by aarpmcgee 3y ago
All I know is, the parts of my app that I implemented with state machines are by far the most stable, least buggy.
fwiw, if xstate feels like too much for whatever reason, https://thisrobot.life https://thisrobot.life has seemed like a decent alternative to me.
- hashbig 3y agoSame here, state machines are fantastic to extend state driven UIs without worrying about breaking existing behavior. If you find XState too verbose consider using a DSL that compiles down to JS like Lucy: https://lucylang.org https://lucylang.org
- simlevesque 3y agoIt seems like both of your links are projects from the same person, he must be passionated about state machines.
- MatthewPhillips 3y agoI am, thank you. : - )
- aarpmcgee 3y agoThanks for all your valuable contributions to this space! I have been curious if development on Lucy is continuing? I might like to port some of my existing machines over if the project is still active.
- _heimdall 3y agoCan confirm.
- astrange 3y agohttp://www.colm.net/open-source/ragel/ http://www.colm.net/open-source/ragel/ is good if you're more on the C side. hmm… seaside… C side… has this been used for anything yet?
- psnehanshu 3y agoLooks like Lucy compiles down to XState.
- cardamomo 3y agoThere's also a pared down, minimal version of xstate: https://github.com/statelyai/xstate/tree/main/packages/xstate-fsm https://github.com/statelyai/xstate/tree/main/packages/xstat...
- aarpmcgee 3y agoI didn't know about this. Thanks a bunch.
- nailer 3y agoYou could also just make a very simple State machine. They don’t take a huge amount of code. you have a variable with the current state, you have a function that takes the previous state and the new State as arguments, now implement whatever logic you need. Not everything needs a library. Pardon the unnecessary caps, I am using voice dictation.
- chombier 3y agoWhen I need something lightweight I usually implement state machines using generators/coroutines when the language provides them, as they compose well and I find it easier to follow to control flow anyways.
- burntcaramel 3y agoI’m curious how you use and compose generator functions? I created a JavaScript state machine library using them to define each state. https://github.com/JavaScriptRegenerated/yieldmachine https://github.com/JavaScriptRegenerated/yieldmachine I imagine your approach must be different?
- chombier 3y agoTo compose generators I use `yield*` (or `yield from` in python) https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Operators/yield\ https://developer.mozilla.org/fr/docs/Web/JavaScript/Referen...* (note that last star is actually part of the link) The main drawback with this approach is that it is easy to blow the stack, but it is not too hard to implement trampolining on top of it (by yielding the continuation to a wrapper generator) To use the generator I send its inputs using `.next()` and obtain current state information, as shown on your library webpage.