* multi-eq hash tables [not found] ` <20220503172106.30B09C009A8@vcs2.savannah.gnu.org> @ 2022-05-03 18:12 ` Stefan Monnier 2022-05-03 18:58 ` Lars Ingebrigtsen 2022-05-03 19:30 ` [External] : " Drew Adams 0 siblings, 2 replies; 5+ messages in thread From: Stefan Monnier @ 2022-05-03 18:12 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel > -(defconst tool-bar-keymap-cache (make-hash-table)) > +(defconst tool-bar-keymap-cache (make-hash-table :test #'equal)) > + > +(defun tool-bar--cache-key () > + (cons (frame-terminal) (sxhash-eq tool-bar-map))) I've seen such needs in the past. Maybe we should introduce something like: (define-hash-table-test shallow-equal (lambda (x1 x2) (while (and (consp x1) (consp x2) (eql (car x1) (car x2))) (setq x1 (cdr x1)) (setq x2 (cdr x2))) (equal x1 x2))) ...) and we could even improve the weakness support so that `key` used with such a hashtable would mean that as soon as one of the values in the key's list can be GC'd then the entry is removed. This way we could have our hash table such that entries are flushed by the GC when a terminal disappears or when one of the tool-bar-map objects dies (instead of the current code which prevents us from GC'ing the terminal objects and the old tool bar maps). Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: multi-eq hash tables 2022-05-03 18:12 ` multi-eq hash tables Stefan Monnier @ 2022-05-03 18:58 ` Lars Ingebrigtsen 2022-05-03 19:30 ` [External] : " Drew Adams 1 sibling, 0 replies; 5+ messages in thread From: Lars Ingebrigtsen @ 2022-05-03 18:58 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > Maybe we should introduce something like: > > (define-hash-table-test shallow-equal > (lambda (x1 x2) (while (and (consp x1) (consp x2) (eql (car x1) (car x2))) > (setq x1 (cdr x1)) (setq x2 (cdr x2))) > (equal x1 x2))) > ...) Yes, that would be excellent. > and we could even improve the weakness support so that `key` used with > such a hashtable would mean that as soon as one of the values in the > key's list can be GC'd then the entry is removed. > > This way we could have our hash table such that entries are flushed by > the GC when a terminal disappears or when one of the tool-bar-map > objects dies (instead of the current code which prevents us from GC'ing > the terminal objects and the old tool bar maps). Hm, interesting... It's slightly niche, though. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [External] : multi-eq hash tables 2022-05-03 18:12 ` multi-eq hash tables Stefan Monnier 2022-05-03 18:58 ` Lars Ingebrigtsen @ 2022-05-03 19:30 ` Drew Adams 2022-05-03 19:42 ` How to use markers as keys in a hash map? (was: multi-eq hash tables) Stefan Monnier 1 sibling, 1 reply; 5+ messages in thread From: Drew Adams @ 2022-05-03 19:30 UTC (permalink / raw) To: Stefan Monnier, Lars Ingebrigtsen; +Cc: emacs-devel@gnu.org I don't mean to divert, here. Just thought this might be related. Is there perhaps a bug here? Seems like it. https://emacs.stackexchange.com/q/71607/105 ^ permalink raw reply [flat|nested] 5+ messages in thread
* How to use markers as keys in a hash map? (was: multi-eq hash tables) 2022-05-03 19:30 ` [External] : " Drew Adams @ 2022-05-03 19:42 ` Stefan Monnier 2022-05-04 15:52 ` [External] : " Drew Adams 0 siblings, 1 reply; 5+ messages in thread From: Stefan Monnier @ 2022-05-03 19:42 UTC (permalink / raw) To: Drew Adams; +Cc: Lars Ingebrigtsen, emacs-devel@gnu.org Drew Adams [2022-05-03 19:30:09] wrote: > I don't mean to divert, here. And yet! > Just thought this might be related. Not really. > Is there perhaps a bug here? There might have been, but it seems to be fixed in `master` because I can't reproduce it. Can you? Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [External] : How to use markers as keys in a hash map? (was: multi-eq hash tables) 2022-05-03 19:42 ` How to use markers as keys in a hash map? (was: multi-eq hash tables) Stefan Monnier @ 2022-05-04 15:52 ` Drew Adams 0 siblings, 0 replies; 5+ messages in thread From: Drew Adams @ 2022-05-04 15:52 UTC (permalink / raw) To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel@gnu.org > > I don't mean to divert, here. > > And yet! Sorry. > > Just thought this might be related. > > Not really. > > > Is there perhaps a bug here? > > There might have been, I guess you're confirming that the behavior described is/was incorrect - a bug. > but it seems to be fixed in `master` because > I can't reproduce it. Can you? I don't build Emacs. I see it on Emacs 26.3 and 27.2. I let the OP know that it seems to be fixed in Emacs 29. https://emacs.stackexchange.com/a/71643/105 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-04 15:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <165159846589.6567.527908635296473829@vcs2.savannah.gnu.org> [not found] ` <20220503172106.30B09C009A8@vcs2.savannah.gnu.org> 2022-05-03 18:12 ` multi-eq hash tables Stefan Monnier 2022-05-03 18:58 ` Lars Ingebrigtsen 2022-05-03 19:30 ` [External] : " Drew Adams 2022-05-03 19:42 ` How to use markers as keys in a hash map? (was: multi-eq hash tables) Stefan Monnier 2022-05-04 15:52 ` [External] : " Drew Adams
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.