Hacker News new | past | comments | ask | show | jobs | submit login

When the author here speaks of coroutines vs explicit state machine, by the latter they are referring to doing things like checking if `currentState == State.LOADING` or setting `currentState = State.COMPLETE`?



Mostly the second one. You’ll have a single bit of boilerplate checking the current state and jumping to the right bit of code; but when you’re actually implementing the core logic of your state machine, you’ll be doing lots of “state = do_the_next_thing; return” instead of just calling “do_the_next_thing()” directly.


Thanks, when I said "or" there I meant to provide just another example of a state machine type implementation so they weren't to the exclusion of each other..theu were both examples of explicit state machine. Thanks for your point though a lot state = vs return next_thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: