[gambit-list] Wills from beyond.

Estevo euccastro at gmail.com
Mon Dec 23 12:51:04 EST 2013

> Yes.  So to be clearer, Gambit’s runtime system keeps a weak reference
> to each will created with make-will.  The weak reference is severed when
> the will’s action procedure is executed, making the will unreachable.
> allows the will object itself to be reclaimed after the action procedure
> executed.

Clearer indeed!

Just for the benefit of anyone following this (i.e. this is not a
question), I inferred this in the gsi REPL: the weak reference to the will
seems to be severed even if the action procedure has made the object
reachable again (e.g. by setting a global variable to it).  Now, even if
you keep a strong reference to the will, its action procedure *won't*
execute when the object becomes weakly reachable again.

> (define o (cons 'o 'o))
> (define w (make-will o (lambda (x) (println "saving o") (set! o x))))
> (set! o #f)
> (##gc)
saving o
> (set! o #f)
> (##gc)
> w
#<will #3>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20131223/e853858d/attachment.htm>

More information about the Gambit-list mailing list