Using the done kind of flags is complicated because with several run() calls in place, e.g., a tape_load() followed by a regular run(), the caller side would need to take explicit measures to make sure the the runs in the middle did not terminate due to user actions, such as pressing ESC or F10. These extra checks are easy to forget and misimplement whereas with exceptions it looks like it would be pretty straightforward and natural.
Once done, the stop() function should merely raise that exception.
Using the
done
kind of flags is complicated because with severalrun()
calls in place, e.g., atape_load()
followed by a regularrun()
, the caller side would need to take explicit measures to make sure the the runs in the middle did not terminate due to user actions, such as pressingESC
orF10
. These extra checks are easy to forget and misimplement whereas with exceptions it looks like it would be pretty straightforward and natural.Once done, the
stop()
function should merely raise that exception.