caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Limitations of continuation?
@ 2006-02-08 22:22 Till Varoquaux
  0 siblings, 0 replies; only message in thread
From: Till Varoquaux @ 2006-02-08 22:22 UTC (permalink / raw)
  To: caml-list

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


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

only message in thread, other threads:[~2006-02-08 22:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-08 22:22 Limitations of continuation? Till Varoquaux

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