Hi,

I'm interested in writing scripts that can execute code in the ocaml toplevel as if the user had added the input by hand. In particular, I'd like to let the user pass parameters to my script and then use those. For example,

let user_module = Sys.argv.(1);;
#load user_module;;

Or, more ambitiously,

let user_expr = Sys.argv.(1);;
user_expr;;

The first example doesn't work, as #load needs a string literal and the second example works, but does not produce the desired effect - that of interpreting and executing an ocaml expression passed on the command line.  Currently, to get around these limitations I'm collecting the user's parameters, using them to fill in a script template, dumping the filled-in template into a temp file, and then executing "ocaml" on the temp file. I'd prefer to avoid this level of complexity.

Thanks,
Yitzhak Mandelbaum

--------------------------------------------------
Yitzhak Mandelbaum
AT&T Labs - Research