Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Saving the OCaml interpreter state
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-04-22 (10:00)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Saving the OCaml interpreter state
Sorry for the late answer, I'm catching up with this list.

> In several read-eval-print loops for functional languages
> (e.g. Poly, SML/NJ, various LISPs), its possible to save and
> restore the current state so you can start up again in an
> environment with all the same objects and name bindings
> present. OCaml does not currently allow this. How hard would it be
> to modify OCaml to support save/restore of sessions?

Definitely not trivial.  In addition to the general problem with
external libraries mentioned by Gerd Stolpmann, there is a more
Caml-specific problem: code fragments generated by the toplevel reside
in many different blocks, which is something that the Caml marshaller
doesn't support.  There would be a lot of non-trivial code relocation
work to perform.

> More specifically, I want to
> know whether the facility to save and restore state doesn't exist
> because
> * None of the main OCaml developers particularly care about it
> or
> * There are non-trivial technical problems implementing it.

Both :-)  There are technical problems, and you are the only user who
expressed a strong desire for this feature.  Personally, it brings
back bad memories of early Lisp and ML implementations where saving
the state of the toplevel loop was the only way to build executable


- Xavier Leroy