caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* marshalling objects
@ 2005-11-11  4:54 Pietro Abate
  2005-11-11  5:21 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 6+ messages in thread
From: Pietro Abate @ 2005-11-11  4:54 UTC (permalink / raw)
  To: ocaml ml

Hi all,

It's not clear to me if it is possible or not to marshall objects ? From
my tests it is not the case (output_value: abstract value (outside
heap).). Am I missing something ? What is common practice to send
objects across the wire ?

thanks,
p

--------- ex.ml

class node = object val d = 1 end ;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.Closures])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.No_sharing])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.No_sharing;Marshal.Closures])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;


-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 6+ messages in thread
* marshalling objects
@ 2008-04-25 20:42 Jacques Le Normand
  2008-04-26  6:45 ` [Caml-list] " Basile STARYNKEVITCH
  2008-04-26  7:42 ` Richard Jones
  0 siblings, 2 replies; 6+ messages in thread
From: Jacques Le Normand @ 2008-04-25 20:42 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

hello caml list,
if I marshal an object of class c and I write the result in a file foo.txt
and, later on, I add methods to c, can I read the object in foo.txt and call
the new methods on the object?
cheers
--Jacques

[-- Attachment #2: Type: text/html, Size: 231 bytes --]

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

end of thread, other threads:[~2008-04-26  7:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-11  4:54 marshalling objects Pietro Abate
2005-11-11  5:21 ` [Caml-list] " Jacques Garrigue
2005-11-14  9:49   ` sejourne_kevin
2005-11-14 10:01     ` Jacques Garrigue
2008-04-25 20:42 Jacques Le Normand
2008-04-26  6:45 ` [Caml-list] " Basile STARYNKEVITCH
2008-04-26  7:42 ` Richard Jones

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