caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem marshaling functions
@ 2004-01-30 16:41 christophe.gensoul
  0 siblings, 0 replies; only message in thread
From: christophe.gensoul @ 2004-01-30 16:41 UTC (permalink / raw)
  To: caml-list

Hi list,

I am working on a project in which function marshalling is of a great use.
Actually I want to marshal and then send over the network list of partially
applied functions (always top level functions). However the behaviour of such
marshalling is not what I had expected.

Actually I would like the following code to pass the assert :

let a = ref 3;;

let f() = !a

let main () =
   let s = Marshal.to_string f [] in
   a := !a + 1;
   let g = Marshal.from_string s 0 in
   assert(g () = !a)
;;

let () = main ()

The problem here is that the whole envirronment of the function seems to be
marshaled (all its dependencies).

Since the my programs all run the same code (imposed by function marshalling)
wouldn't it be possible to marshal all free variables of the function "by
reference". What I mean by that is that istead of marshalling the value of free
variables, I'd like to marshal adresses of such variables.

What I want to achieve is that all the state that is access in the function
doesn't travel with it. When arriving at destination, I want to use the state of
the destination (it's the same program on both side).

The only thing I can imagine for achieving that is to modify the way marshaling
does its job. But I really don't know how it work and where I should look in the
source for changing that.

Is it possible? If yes.
Is it very complicated to do?
Should it take a long time to achieve?
Where can I find documentation on the implementation of the marshalling in OCaml?

Thanks for any help.

Christophe

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-30 16:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30 16:41 [Caml-list] Problem marshaling functions christophe.gensoul

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