caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@anu.edu.au>
To: ocaml ml <caml-list@inria.fr>
Subject: marshalling objects
Date: Fri, 11 Nov 2005 15:54:30 +1100	[thread overview]
Message-ID: <20051111045430.GA17854@pulp.anu.edu.au> (raw)

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


             reply	other threads:[~2005-11-11  4:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-11  4:54 Pietro Abate [this message]
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

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=20051111045430.GA17854@pulp.anu.edu.au \
    --to=pietro.abate@anu.edu.au \
    --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;
as well as URLs for NNTP newsgroup(s).