Re: Script to create a "restart" directive in toplevel

"'Mr. Herr' [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>

On 06.09.2015 11:26, [email protected] [ocaml_beginners] wrote:
> When I build projects with ocaml I use the toplevel a lot,
> and it would make my life much easier if I had a way to compile
> the following sequence of commands in a unique
> unit->unit function (say ):
>
> #quit;; (* leave current toplevel *)
> make (* recompile *)
> ./ocaml (* enter newly compiled toplevel *)
>
>
> I have incomplete ideas about how to achieve this. For the
> middle command I obviously can use Sys.command "make";;,
> and I think I must somehow change the order of the commands
> (the old toplevel executable must somehow "leave a message"
> indicating to launch the new toplevel before self-destructing).
>
> Any help appreciated.
I would do the compile and test cycle at the shell level.

Proof of concept:

# if you terminate the toplevel with Ctrl+d, it will be restarted, Ctrl+c stops the loop:
while true; do echo '---bouncer! will have to add make -----' && rlwrap ocaml; done

Hope this helps.

/Str.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.