Version française
Home     About     Download     Resources     Contact us    
Browse thread
Native delimited continuations for bytecode OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Native delimited continuations for bytecode OCaml
Oups, sorry the mail was sent while I was typing (someone accidentally
pressed enter...).

Can your code be used for unlimited continuation? I am currently
using code that looks somewhat like this:

let suspend ()=
   and save_state k=
     let oc=open_out_bin "state" in
       Marshal.to_channel  oc  k  [Marshal.Closures]);
       close_out oc;
     (* Skips a warning because this function does not return (it is an exit
        point)*)
     ignore(exit 0)
   in
   callcc save_state
(* If there is a resume point skip to it
*)
 let _ =
   if (Sys.file_exists "state") then
    ( let oi = open_in_bin "state" in
      let k=Marshal.from_channel   oi in
       Sys.remove("state");
       close_in oi;
       throw k ());

[note]This code was simplified for sake of clarity and might have small errors.

I was wondering if something similar is possible with your library?

Regards,
Till Varoquaux