Hacker News new | past | comments | ask | show | jobs | submit login
Update on Structured Concurrency (250bpm.com)
53 points by rumcajz on Oct 19, 2018 | hide | past | favorite | 4 comments



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.


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.


How is this different compared to asyncio?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: