3 ms·
So I glossed over this thread when I first saw it, and something drew me back. My first thought when reading the description is that it reminds me of the 'with
by hinkley 5y ago
So I glossed over this thread when I first saw it, and something drew me back.
My first thought when reading the description is that it reminds me of the 'with' semantics you see for resource management, where the API gives you an resource that lives for the lifetime of the closure, and then is destroyed or returned to a pool.
That's is a refinement of RAII, where the API may initialize the connection or may allocate an existing one to you that is no longer in use (serial acquisition).
This feels like a refinement of that for thread lifetimes, which are probably not a bad thing.
- parksy 5y agoI think I'm getting the picture from this and other replies. To get close to a sense of structured concurrency I've had to lean on a plugin that handles worker threads (or would have to write one myself), and tie this in with async/await language features, and add some checks to handle thread lifetime and error states. It would be really nice to have a first class language feature to wrap all this up, it sounds like that's what structured concurrency as a concept is aiming towards.