[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using finalizers
From: |
Tomas Hlavaty |
Subject: |
Re: using finalizers |
Date: |
Fri, 31 Dec 2021 12:18:21 +0100 |
On Fri 31 Dec 2021 at 18:59, LdBeth <andpuke@foxmail.com> wrote:
>>>>>> In <875yr5p9t3.fsf@logand.com> Tomas Hlavaty <tom@logand.com> wrote:
> Tomas> One more question: Because make-finalizer in Emacs Lisp does
> Tomas> not take the object into account, I have to make sure to hold
> Tomas> the reference to the finalizer somehow. However, this might
> Tomas> not be trivial, because a smart compiler could eliminate the
> Tomas> reference. Is this not an issue?
>
> That's being too smart. And I don't think the bytecode compiler can do
> the lifetime analaysis right now. It is possible that this could be
> changed in future releases of Emacs.
ok, so if I understand it correctly, in other words, the make-finalizer
interface relies on the compiler being not very smart
> Tomas> Shouldn't make-finalizer take the object as an argument and not
> Tomas> rely on me holding the reference explicitly?
>
> You would only need finalizers for complex objects, so ideally you
> could use OOP to manage that, probably EIEIO but not limited to that,
> and you may even come up with your own.
What do you mean?
Why not do it "properly" and future-proof the make-finalizer interface,
pass the object explicitly there and leave the rest as implementation
detail instead of leaking the issue to the programmer?
Re: using finalizers, Eli Zaretskii, 2021/12/31
Re: using finalizers, LdBeth, 2021/12/31