Re:Co-routines as an alternative to state machines
by silentbicycle on Saturday August 29, 2009 @04:30PM
(#793587)
It's not always just two coroutines (could be thousands), and not every language has TCO.
Also: While mutable state is problematic, sometimes the alternatives are worse.
Re:Co-routines as an alternative to state machines
by silentOpen on Saturday August 29, 2009 @11:20PM
(#794008)
That's a good point... mutual recursion lacks dynamism.
The lack of TCO or ability to do mutual recursion+TCO is really the fault of the language. If you have a state machine with a small number (<20) states, mutual recursion seems like a more natural fit (unless you have to have states determined at run-time).
Mutable state is your enemy...