caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: Res: [Caml-list] scripting the toplevel
       [not found] <20070601041515.6665.qmail@web51612.mail.re2.yahoo.com>
@ 2007-06-01 10:38 ` Markus E.L.
  0 siblings, 0 replies; only message in thread
From: Markus E.L. @ 2007-06-01 10:38 UTC (permalink / raw)
  To: caml-list


> 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


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

only message in thread, other threads:[~2007-06-01 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20070601041515.6665.qmail@web51612.mail.re2.yahoo.com>
2007-06-01 10:38 ` Res: [Caml-list] scripting the toplevel Markus E.L.

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