<div dir="ltr"><div><div>In gsi, a will that has become unreachable will still execute when its testator is about to become unreachable.<br><br></div>What's more, if the will's action is a closure upon some other object, and if we make that other object unreachable too (such that a different will with that other object as a testator executes), when the action executes it will still be able to access that other object.  This is probably clearer in code:<br>
<br>> (define o1 (cons 'o 1)) <br>> (define o2 (cons 'o 2))<br>> (define w1 (make-will o1 (let ((o2_ o2)) (lambda (x) (println "w1 says bye to " x " but it can still reach " o2_)))))<br>
> (define w2 (make-will o2 (lambda (x) (println "w2 says bye to o2"))))<br>> (define w3 (make-will w1 (lambda (x) (println "w3 says bye to w1"))))<br>> (set! w1 #f)                                                                                                         <br>
> (gc)<br>w3 says bye to w1<br>> (set! o2 #f)<br>> (gc)<br>w2 says bye to o2<br>> (set! o1 #f)<br>> (gc)<br>w1 says bye to o1 but it can still reach o2<br>> <br><br>Is this expected semantics, or just accidental behavior that shouldn't be relied upon?<br>
<br></div>If o2 was a foreign object with a finalizer, would it have been released by the time w1 executed, or would w1's closure reference have kept it alive?<br></div>