freenode/#sicl - IRC Chatlog
Search
13:33:44
Bike
realized i forgot something- the unwinder needs the dynamic environment too. so go-ast and return-from-ast also get the dynenv variable, and if they turn out to be local it's forgotten.
14:54:02
Bike
mm, mostly. i'm less confident about the unwind-protect/bind part, but that's a separate addition anyway
14:58:31
Bike
say you have (block nil (unwind-protect (... (return) ...) (cleanup)) (more-stuff)). with "inlined" unwind-protect, the return is local, but you still have to clean up - so you basically have to duplicate the cleanup call, so that there's one for the return and one for the no-return where it goes on to more-stuff
15:00:24
Bike
so do i :) it's a ways off though, i can do the dynamic environment stuff without changing anything about unwind-protect
15:04:54
beach
Yes the return is kind of local, but kind of not. As you pointed out, you still need to unwind the dynamic environment properly.
15:06:58
Bike
I've been thinking of the hypothetical unwind-protect as involving a sort of primitive special operator called with-cleanup, that's like unwind-protect but only does something to the dynamic-environment
15:07:16
Bike
E.g., (with-cleanup (foo) (bar)) will call bar if foo exits abnormally, but otherwise will not.
15:08:42
Bike
This isn't the duplication I meant with the return, but there's a duplication here too yes.
15:11:36
jackdaniel
unless we take into account multiple threads. from observation if thread scope is not wrapped in handler-case cleanup form may not be executed
15:11:58
Bike
No, the cleanup will always be executed, but I came up with this because it matches how it works, uh, under the hood. E.g. in SICL (unwind-protect (foo) (bar)) would be like (progn (let ((*dynamic-environment* (make-unwind-protect-entry #'bar *dynamic-environment*))) (foo)) (bar)) if i'm not mistaken.
15:12:39
Bike
i wouldn't expect a handler-case outside a make-thread to have any effect on it, since the make-thread finishes immediately and the thread goes off to wherever. but i haven't thought about threads in this context yet.
15:14:11
beach
jackdaniel: What do you mean by "crash" in this context? Sure, if the debugger is invoked and never exited, then the cleanup will never be executed.
15:18:16
jackdaniel
maybe I was not precise with what I said. when program is run not interactively with a debugger disabled *and* if a thread doesn't have handler-case above unwind-protect cleanup forms may not get executed