When user has special logic for, say, termination (i.e. waiting for some other actors to finish), it has to keep track of status as the internal state:
struct MyState {
// .. some useful data about actor's internal state ..
terminating: bool, // <-- flag that actor should do clean-up actions before termination
}
This can cause bugs that are difficult to catch (forgetting about the terminating flag when updating the state). Instead, we can provide some API to read actor's status, so user is not obligated with keeping status-related information in the internal state.
When user has special logic for, say, termination (i.e. waiting for some other actors to finish), it has to keep track of status as the internal state:
This can cause bugs that are difficult to catch (forgetting about the terminating flag when updating the state). Instead, we can provide some API to read actor's status, so user is not obligated with keeping
status
-related information in the internal state.