caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* GC and map
@ 2006-05-15 12:32 Christophe Raffalli
  2006-05-15 12:46 ` [Caml-list] " Daniel Bünzli
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Raffalli @ 2006-05-15 12:32 UTC (permalink / raw)
  To: caml-list


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
---------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-15 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-15 12:32 GC and map Christophe Raffalli
2006-05-15 12:46 ` [Caml-list] " Daniel Bünzli
2006-05-15 19:38   ` Christophe Raffalli

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).