guile-user
[Top][All Lists]
Advanced

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

Re: How to use guardians


From: Kjetil S. Matheussen
Subject: Re: How to use guardians
Date: Thu, 13 Mar 2008 16:02:36 +0100 (CET)


Thien-Thi Nguyen:
        (das-guardian (list cleanup-func object)))

 Here, you add the compound object (constructed using `list'),
 not just `object'.  Is that what you want do, really?


Ah, of course. Thank you very much. Also for the mysteriously
quick reply. :-)

I have now changed "add-guardian-object" into:

   (define das-guardians '())
   (define (add-guardian-object object cleanup-func)
     (set! das-guardians
           (remove (lambda (das-guardian)
                     (let ((guard ((cadr das-guardian))))
                       (and guard
                            (begin
                              ((car das-guardian) guard)
                              #t))))
                   das-guardians))
     (push! (list cleanup-func
                  (let ((guardian (make-guardian)))
                    (guardian object)
                    guardian))
            das-guardians))



And this seems to work. Great!





reply via email to

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