Structured concurrency: TaskHandle

Attila Kelemen attila.kelemen85 at gmail.com
Sat May 13 13:37:47 UTC 2023


Robert Engels <rengels at ix.netcom.com> ezt írta (időpont: 2023. máj.
13., Szo, 14:47):
>
> Expecting or using a result after calling shutdown seems invalid. The UI example seems especially incorrect. If I am a user and attempt to cancel an operation and the system says “hey here’s your answer anyway” that does not match the user intent - which is a bad UX.

It depends on the circumstances. Obviously, if showing the result
would be obstructive, then you don't show it, but there are other
cases:

1. You just cleanly show the computation result on a UI is not a harm,
if the UI would remain visible after the cancellation anyway.
2. STS will clearly not manage transactions, and operations often have
side effects. An API like this can never really promise that a
cancellation will be honored. In which case it is better not to hide
the fact from the user, that you actually completed the action, or at
least know that the process was started, so there might be something
to inspect. At least I hate UIs that when I cancel the operation, they
don't do it, then outright lie to me that it was canceled. That breaks
my expectation even worse, then ignoring the cancellation (which is
quite often within the allowed set of behaviours).


More information about the loom-dev mailing list