
Update on Structured Concurrency - rumcajz
http://250bpm.com/blog:137
======
lucozade
Thanks for this Martin. Thought provoking as always.

A couple of observations wrt Order Cancellation.

I'm not sure I get your point regarding bundles and scopes. In both the 'with'
case and the RAII case, you're explicitly using them for scoping. I appreciate
there are syntactic pros and cons for different call patterns but,
fundamentally, they're both explicit scoping mechanisms. No?

Also, wrt your point on one thread type per bundle. Wouldn't a standard
producer/consumer be an example? Or did you mean something else by type of
thread.

~~~
rumcajz
As for ordered cancellations, my only point was that having five nested blocks
is ugly. That may seem to be no big deal, but the goal here is really to get
people think in structured way. If the syntactic constructs get into there way
(the identation gets my code beyond the right edge of the screen) they are
likely to cut corners. E.g. use a single scope. Which could in turn cause
problems during shutdown.

As for producer/consumer I think you want to close the producer first,
consumer second, rather than do it in undefined order (in parallel). That way
you can be sure that there are no unconsumed messages before you shut down.

------
person_of_color
How is this different compared to asyncio?

~~~
rumcajz
From John Belmonte's blog post:

While Trio is a competitor of Python’s standard asyncio package, there are
rumblings that the latter will start picking up aspects of structured
concurrency soon.

