Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Emacs 25.1 finalizers #1

Open
dcolascione opened this issue Mar 2, 2015 · 3 comments
Open

Support Emacs 25.1 finalizers #1

dcolascione opened this issue Mar 2, 2015 · 3 comments

Comments

@dcolascione
Copy link

I've added core support for finalizers to Emacs 25.1; it would be nice if this package used the core functionality if available. The core support has special GC hooks that solve the cyclic reference problem.

@skeeto
Copy link
Owner

skeeto commented Mar 3, 2015

Nice work! I'm glad to see this in Emacs' core. I just pulled in the
latest commits to take a look at it. The entire interface is
make-finalizer, correct? What's the proper way to feature test for it? I
don't see a featurep symbol for it, so is it just "(fboundp
'make-finalizer)"?

If the feature is present, I'll not use post-gc-hook and not enforce the
no-circularity constraint. Instead I'll put the target object into a
single, global ":weakness value" hash table with a make-finalizer object
as the key, set to call the user-provided function passed via closure.

Any caveats on how these new # objects hash? It's not every
day Emacs gets a new primitive type, after all! A casual test with
sxhash suggests they'll distribute to different buckets well enough.

@dcolascione
Copy link
Author

On 03/02/2015 06:07 PM, Christopher Wellons wrote:

Nice work! I'm glad to see this in Emacs' core. I just pulled in the
latest commits to take a look at it. The entire interface is
make-finalizer, correct? What's the proper way to feature test for it? I
don't see a featurep symbol for it, so is it just "(fboundp
'make-finalizer)"?

Yep.

If the feature is present, I'll not use post-gc-hook and not enforce the
no-circularity constraint. Instead I'll put the target object into a
single, global ":weakness value" hash table with a make-finalizer object
as the key, set to call the user-provided function passed via closure.

That sounds good to me. Everything should happen automatically. For the
EIEIO mixin, you might want to just make the finalizer object an
embedded field instead of indirecting through the global hash table.

Any caveats on how these new # objects hash? It's not every
day Emacs gets a new primitive type, after all! A casual test with
sxhash suggests they'll distribute to different buckets well enough.

They're hashed by their locations in memory, which should be good enough.

@tarsius
Copy link
Contributor

tarsius commented Nov 28, 2016

Just a little ping to remind you of this suggestion, now that Emacs v25.1 has been released.

(If you don't intend to work on this any time soon, then please consider creating a new commit 1.0.1. Sure there is only one rather minor commit since 1.0.0, but it hasn't made it into a release in three years and told me that it feels a bit sad about being left out.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants