> What options do we have to support such mutating API at the moment?
What is wrong with implementing the states with polymorphic classes providing the API or an interface to it?
What is wrong with implementing the states with polymorphic classes providing the API or an interface to it?
Yeah that's pretty much the basic approach to this problem: use a strategy pattern in all states of the state machine, and just provide definitions for each method in the state that the method makes sense.
That's pretty much how HTTP-based protocols are implemented when status codes drive a state machine.
I wonder why the author decided to ignore the most basic and simple solutions to a frequent problem in favour of a convoluted solution that doesn't add anything and is harder to debug.
https://developer.apple.com/library/archive/documentation/Ge...