3 ms·
This whole subthread about asynchronous objects, and the actor model, made me think of "background" processing where objects have a running life of their own, a
by jlokier 7y ago
This whole subthread about asynchronous objects, and the actor model, made me think of "background" processing where objects have a running life of their own, and it reminded me of a recent HN comment about almost the opposite approach, where nothing is allowed to be spawned off in the "background".
The author contends that Go's "go" (and indeed async blocks in a number of languages) which launch new concurrent objects which the parent block doesn't have to wait for, are a form of badly structured programming.
https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
https://news.ycombinator.com/item?id=21537706
The structured concurrency described there reminds me of "par" blocks in some languages (Occam, Handel-C, XMOS XC), where each statement inside the block runs in parallel and the whole block waits until all statements inside have completed.
They do have asynchronous request/response patterns, but things can't be started and left to carry on running how they want, like you might think of bacteria.
- nurettin 7y agoThe "structured concurrency" pattern, simply amounts to starting some async jobs (concurrent or parallel) and collecting all of them at the end of some context. One antidote to unstructured concurrency is to use something like trio in order to make async job spawning a function of a context manager (called nursery in trio) so all job results will be collected when the nursery block ends.
- wwright 7y agoI believe the structured concurrency article is written by the author of Trio (I could be wrong.)