Re:The Synthesis Kernel (1988) [pdf]
by kazinator on Tuesday August 22, 2017 @10:07PM
(#15077996)
Man that strikes close to home! Breaking invariants when nobody observes it.
I did something in this spirit in my Lisp dialect.
I broke the invariant which says "no matter how you terminate a form, the unwind-protect cleanup forms get called".
I broke it by introducing the concept of "absconding": leaving a scope in such a way that the local resources tied to lexical/dynamic contours are left alone. No unwinding calls are done.
The justification is precisely that it is OK if the scope is later re-entered (specifically: restarted via revived continuation). The revived control then finds everything intact --- and can leave the scopes normally at which point the cleanup does take place.
By doing this, I solved the problem of how to integrate continuations with scoped resource acquisition/cleanup, without the horror of dynamic-wind or its ilk.
I did something in this spirit in my Lisp dialect.
I broke the invariant which says "no matter how you terminate a form, the unwind-protect cleanup forms get called".
I broke it by introducing the concept of "absconding": leaving a scope in such a way that the local resources tied to lexical/dynamic contours are left alone. No unwinding calls are done.
The justification is precisely that it is OK if the scope is later re-entered (specifically: restarted via revived continuation). The revived control then finds everything intact --- and can leave the scopes normally at which point the cleanup does take place.
By doing this, I solved the problem of how to integrate continuations with scoped resource acquisition/cleanup, without the horror of dynamic-wind or its ilk.