[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: (not) handling new programming idioms with grace
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 15 Jul 2018 17:36:32 +0200
2018-07-15 16:22 GMT+02:00 John Belmonte <firstname.lastname@example.org>:
> It's been about 10 years since my post "state of the Lua nation on resource
> cleanup" . The only relevant thing that's happened in this area since
> then was Lua getting pcall + coroutine love in 5.2.
> My position on Lua's need for some type of scope exit hook is only stronger
> these days. It's not just about resource cleanup. For example, there are
> some very interesting concurrency and cancellation control structures being
> developed as Python libraries   which would be cumbersome and much
> less effective in a language lacking the equivalent of Python's "with"
> To summarize the concurrency control structure, called a "nursery": all
> spawned tasks within the scope block are owned by that scope's context
> manager, and the scope will not end until all child tasks are completed. If
> a child has an exception, all other child tasks will be cancelled and the
> error will be propagated. I'm well versed in trying to use Lua function
> lambdas for this kind of problem. The result is not satisfying.
I don't quite understand the problem, and maybe my ignorance shows,
What does a 'with' structure achieve that
if exception then break end