English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Attributes for free
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-09-26 (03:29)
From: David Baelde <david.baelde@g...>
Subject: Attributes for free

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.