Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Bug or feature?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: [Caml-list] Bug or feature?
I'm not sure whether this is a bug or a feature.

I need to save the state of the Xcaml session between CGI 
executions. Thinking in terms of Jserv-compliant 
implementation, i used a Weak.Make(...).t hashtable to store 
  session data, so that old and no longer used data might be 
automatically reclaimed by the GC. However, I found that 
this implementation is buggy, because when I marshal and 
unmarshal the weak hashtable, I always get an empty 
hashtable back. Why is this?

I made a switch to Hashtbl.Make(...).t and now the session 
handling in Xcaml works fine, except that there is no 
automatic garbage collection. All other code, except for 
minor modifications due to incompatibilities between the 
output signatures of Hashtbl.Make and Weak.Make, has been 
left untouched.

One more remark concerning the Weak.Make functor. Why in the 
world are Hashtbl.Make and Weak.Make incompatible? It is 
only natural to think of the second as a particularly clever 
implementation of the first. Besides, the two modules are so 
similar that really deserve to have the same signatures. I 
strongly encourage the Caml Masters to think this over. Of 
course, I could reimplement the Weak.Make functor in a Weak2 
module for the ocamllib-addons package, but is it worth it?

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners