I had a gist for something like this, but I can’t ...
# announcements
o
I had a gist for something like this, but I can’t find it now… The idea is that you create an (inline) function
context
that gets a lambda, and executes its contents with a reciever. Reciever accumulates calls for
defer
block. So you have something like this:
Copy code
context {
    defer { … }
    foo()
    bar()
    defer { … }
    baz()
}
Then, if exception happens or block returns normally, it executes all registered deferred lambdas