caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: caml-list@inria.fr
Subject: Re: Request for weak functional map ...
Date: Sun, 04 Dec 2005 11:03:01 -0500	[thread overview]
Message-ID: <878xv0etui.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> (raw)
In-Reply-To: <4390B875.3080206@univ-savoie.fr>

> I wish a data structure similar to the Map provided by standard library
> (logarithmic insertion and deletion) ... but with a "weak key" behavior:

Of course you can implement it in the GC (although it can be tricky if you
data-structure is complex, as you mention).  But another way to do it is to
use a normal non-weak Map but using weak-references for the keys and then
"every once in a while" scan the map to remove entries whose weak-key has
been collected.

If you implement the Map yourself (rather than using the library version),
you can do the weak-key-sweep as part of the normal tree traversal done
during lookups and insertions.


        Stefan


      parent reply	other threads:[~2005-12-04 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-02 21:11 Christophe Raffalli
2005-12-03  0:21 ` [Caml-list] " skaller
2005-12-04 16:03 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xv0etui.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).