...
- dynamic binding
*scope*holds collection of things needing cleanup - with-open binds a new
*scope*, cleans up*scope*at end - lib APIs can call a new fn
(scope thing)to add a resource to the current bound scope- throws exception if no scope available
- REPL cleans up scope before every loop
- *scope* is an atom, so N "child" threads can add to it
- binding conveyance makes this work
- still up to you to make sure "parent" thread outlives children
- this patch demonstrates the idea
IMO this nails all the use cases and problems above, with a few
caveats that I think can be subsumed into a single example as follows:
...