Browse thread
Re: Res: [Caml-list] scripting the toplevel
- Markus E.L.
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus E.L. <ls-ocaml-developer-2006@m...> |
| Subject: | Re: Res: [Caml-list] scripting the toplevel |
> Hi Markus, > > I found your example very instructive. Thanks. > I need generate expressions on the fly and evaluate them many times during program execution. Somehow I have a gut feeling, that this might not be such a good idea: At least it sounds inbelievable dirty. I used Gerd Stolpmann's trick only to implement new toplevel directives (I wanted to add findlib paths using a toplevel directive), specifically invoke toplevel directives from others at the beginning of ocaml scripts. I'm not sure what happens if you do that in a loop ... > I would like to know how to compile your program using ocamlopt. Is > it possible? No. The module Toplevel is only available in the Toplevel, AFAIK. > How can I do it? Your program needs to be executed by the toplevel. You can compile your application modules to bytecode and add them to the toplevel with ocamlmktop. At the top of it all there must be a script, even if it only consists of 'MainApp.main ()'. Now that I think about it, I wonder wether it would not suffice that MainApp's init code would contain an infinite loop: The new toplevel never would go to interacting, but execute your application. Try it? Regards -- Markus