unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Weak reference facility in Emacs.
@ 2020-01-22 14:11 Zhu Zihao
  2020-01-23 17:59 ` John Wiegley
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Zihao @ 2020-01-22 14:11 UTC (permalink / raw)
  To: emacs-devel

Weak reference is good idea to deal with cycle reference. Though Emacs has GC,
but weak reference is also useful when I want to use RAII pattern in Emacs (via
finalizer).

hash table has option to make reference in it become weak. But it's not
so convenience if user just want a weak reference of *ONE* lisp object.

Would you interest in some lisp library to wrap a weak table to provide weak
referenece utils. Or it's better to implement it in alloc.c?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Weak reference facility in Emacs.
  2020-01-22 14:11 Weak reference facility in Emacs Zhu Zihao
@ 2020-01-23 17:59 ` John Wiegley
  0 siblings, 0 replies; 2+ messages in thread
From: John Wiegley @ 2020-01-23 17:59 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: emacs-devel

>>>>> "ZZ" == Zhu Zihao <all_but_last@163.com> writes:

ZZ> Would you interest in some lisp library to wrap a weak table to provide
ZZ> weak referenece utils. Or it's better to implement it in alloc.c?

I would prefer this not to be alloc.c, but to use existing idioms until it
proves to be of enough general use that it warrants optimization by moving
into the C code.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-23 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 14:11 Weak reference facility in Emacs Zhu Zihao
2020-01-23 17:59 ` John Wiegley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).