caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Till Varoquaux <till.varoquaux@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Limitations of continuation?
Date: Wed, 8 Feb 2006 23:22:52 +0100	[thread overview]
Message-ID: <9d3ec8300602081422q17fa1cb4wd0e2c2587063f0a1@mail.gmail.com> (raw)

Xavier Leroy wrote a small continuation proof of concept module which
can be found here:
http://pauillac.inria.fr/~xleroy/software.html

I've been toying with it lately whilst doing so I stumbled across a problem:

I'm using a module containing the following code:

let continuation_to_string k =
  let c=Marshal.to_string k [Marshal.Closures] in
  Netencoding.Base64.encode ~linelength:72 c

let send_page (f:string->unit) =
  let apply f k=
    f (continuation_to_string k)
  in
  Callcc.callcc(apply f)

let _ =
  try (
    let cgi = new Netcgi.std_activation () in
    let res = (
      let cont=(cgi#argument "continuation") # value in
      Netencoding.Base64.decode ~accept_spaces:true cont
    ) in
    let k=Marshal.from_string res 0 in
    Callcc.throw k ())
  with Not_found -> ()

I have a test app using this module. If I compile it with a standard
Open ... the code segfaults, however if I inline the code (i.e. not
actually putting it in a separate file) the application works just
fine. I guess the compiler builds different code since it is working
with modules. Where those this come from and would there be anyways to
work around it ?

Regards,
Till


                 reply	other threads:[~2006-02-08 22:22 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=9d3ec8300602081422q17fa1cb4wd0e2c2587063f0a1@mail.gmail.com \
    --to=till.varoquaux@gmail.com \
    --cc=caml-list@yquem.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).