[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using finalizers
From: |
Eli Zaretskii |
Subject: |
Re: using finalizers |
Date: |
Fri, 31 Dec 2021 09:50:41 +0200 |
> Date: Fri, 31 Dec 2021 10:46:20 +0800
> From: LdBeth <andpuke@foxmail.com>
> Cc: emacs-devel@gnu.org
>
> > What is the expected example usage of finalizers in Emacs Lisp?
> > How can I verify, that my finalizer works?
>
> (setq bar nil)
> (setq foo (make-finalizer (lambda ()
> (setq bar t))))
>
> (setq foo nil)
> (garbage-collect)
>
> bar ; => t
I think that the assumption that a call to garbage-collect will
necessarily call the finalizer is also problematic: there's usually no
simple way to make sure there are no references left to the object,
and GC could have its own ideas when to actually garbage-collect an
object.
- Re: using finalizers, (continued)
Re: using finalizers,
Eli Zaretskii <=
Re: using finalizers, LdBeth, 2021/12/31