Lauren Pullen drurowin@gmail.com schrieb am Di., 29. Nov. 2022, 04:45:
What's more, since these options cause branches in different methods... in different packages... and might be at the whim of the person in front of the screen... they go beyond the capabilities of only condition handlers.
Yup. But in case anyone of the readership wonders: restarts can also be invoked automatically by exception handlers. In case you don't want (or need) to leave the choice to the human with the cat on their laptop in some case. Thus restarts should be considered part of the interface of a solution, just like the exception types to be expected.
In a game I wrote 12 years ago I used restarts to put a request that arrived in an untimely manner (peer to peer communication between three parties) into a waiting queue of the messaging component to be redelivered later. That was in response to the exception of the game logic component that the request could not be processed by the state machine at this time.