chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] newbie: questions about set-finalizer!


From: Alejandro Forero Cuervo
Subject: [Chicken-users] newbie: questions about set-finalizer!
Date: Mon, 15 Dec 2008 23:57:31 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

I have a question about finalizers.

If you run the following in csi:

  (define x (list 1 2 3))
  (begin (set-finalizer! x (lambda (o) (format #t "Delete: ~A~%" o))) #t)
  (define y (list 4 5 6))
  (begin (set-finalizer! y (let ((p x)) (lambda (o) (format #t "Delete: ~A: 
~A~%" o p)))) #t)
  (gc #t)
  (set! x #f)
  (gc #t)

Why do you get “Delete: (1 2 3)”, the output of the finalizer for x,
even though the finalizer for y depends on the value of x?

Am I misunderstanding the way finalizer procedures get executed?

Alejo.
http://azul.freaks-unidos.net/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]