From: christophe.gensoul@epfl.ch
To: caml-list@inria.fr
Subject: [Caml-list] Problem marshaling functions
Date: Fri, 30 Jan 2004 17:41:22 +0100 (MET) [thread overview]
Message-ID: <1075480882.401a893217a12@imapwww.epfl.ch> (raw)
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
reply other threads:[~2004-01-30 16:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1075480882.401a893217a12@imapwww.epfl.ch \
--to=christophe.gensoul@epfl.ch \
--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