3 ms·
It's also a convenient way to implement "value-based" state machines (where the entire machine is a single type with a value for each state, as opposed to type-
by masklinn 9y ago
It's also a convenient way to implement "value-based" state machines (where the entire machine is a single type with a value for each state, as opposed to type-based where each state is implemented as a different — and possibly completely incompatible — static state).
- tomjakubowski 9y ago+1. They are a huge help for managing things like connection state. You can create powerful, statically-enforced invariants, like that a lifetime of a socket is 1:1 with a state of your state machine.