logoalt Hacker News

dfawcus01/23/20250 repliesview on HN

Except Contexts provide a cancellation mechanism which can be used outwith of a specific dynamic call graph.

The documented semantics of the facility (and the implementation) seemed perfect for destroying a dynamic graph of CSP elements, which were exchanging messages. Where the cancellation causes the goroutines within the (think Actor-like) CSP element to clean up, tear down, and exit.

The warning about not storing it in a struct seems to assume it can only be used for one specific type of purpose, say web server processes and/or related database requests.

If I hadn't used it, I would have had to create something almost identical - but without the ability to store a data element.