caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
To: caml-list <caml-list@inria.fr>
Subject: GC and map
Date: Mon, 15 May 2006 14:32:14 +0200	[thread overview]
Message-ID: <446874CE.6010405@univ-savoie.fr> (raw)


Hello,

I would like to implement the feature described bellow ... I think this is impossible in the current
state of OCaml, but I may be wrong, so if someone can help ...

'a map is the type of a functional map from int to 'a (I do not care about the internal 
representation, except that performance would matter a little too)

set is the type for set of int (here again representation do no matter that much)

All maps can only appear in structure of type
environment = { accessible_keys : set; map : 'a map }
(this is possible to enforce with abstract type)

Then I would like the GC to behave like this :

  Let m be of type 'a map and alive. Assume it appears only in the following alive environment
{ accessible_keys = a1; map = m }
{ accessible_keys = a2; map = m }
...
{ accessible_keys = an; map = m }

Then, I would like the GC to remove all bindings in m for integers not present in a1 ... an.
It would even be better if values associated to these bindings where not even scanned by the GC, but 
I think this is much more difficult.

Any Idea (purely in OCaml or in C) ?

This would be possible in C if in the "struct custom_operations" there was a "scan" function to scan 
values inside an allocated custom block. This function would be very similar to the serialize 
function ... Anyway I would prefer a pure OCaml solution.


-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------


             reply	other threads:[~2006-05-15 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-15 12:32 Christophe Raffalli [this message]
2006-05-15 12:46 ` [Caml-list] " Daniel Bünzli
2006-05-15 19:38   ` Christophe Raffalli

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=446874CE.6010405@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --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).