Hello,
I found myself wanting to reference the finalized object from a finalizer, so I added this wrapper around trivial-garbage:finalize, using a weak pointer to avoid permanently referencing the object from the finalizer closure.
(defun add-finalizer (x f) (setf p (make-weak-pointer x)) (setf g (lambda () (funcall f (weak-pointer-value p)))) (finalize x g))
Would there be any problems with adding this function to the main library? I could probably provide a patch if requested.
Best regards, Hans