caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David Baelde" <david.baelde@gmail.com>
To: Ocaml <caml-list@inria.fr>
Subject: Attributes for free
Date: Tue, 26 Sep 2006 05:29:25 +0200	[thread overview]
Message-ID: <53c655920609252029h770cbd2s79561eedd4e711d6@mail.gmail.com> (raw)

Hi,

I have a lambda-term representation, which is used in intensive
computations. I'd like to attach some attributes to some of these
terms, like naming hints for abstracted variables, parsing or typing
information. This information wouldn't be accessed very often,
typically not in my intensive computations.

I could of course extend my datatype to do that. But (1) it takes a
non-trivial modification of the code in several of my modules (2)
making the term representation heavier might make my computations
slower. Thus, I'm looking for an other solution.

I could use some hash table. The problem is that it doesn't play well
with GC: if I release some term, the GC might not be able to erase it
if it's referenced in the table, and it won't be able to erase the
associated attributes either.

Any idea ? I don't know much about weak hashtables, I especially have
no idea about the erasing strategy. Could it help ?

Thanks for any advice.
-- 
David


                 reply	other threads:[~2006-09-26  3:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=53c655920609252029h770cbd2s79561eedd4e711d6@mail.gmail.com \
    --to=david.baelde@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=david.baelde@ens-lyon.org \
    /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).