From: Yitzhak Mandelbaum <yitzhak@research.att.com>
To: caml-list@yquem.inria.fr
Subject: scripting the toplevel
Date: Wed, 30 May 2007 11:27:17 -0400 [thread overview]
Message-ID: <7D7BAFC8-9689-4985-B6AE-E83AB95398C4@research.att.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]
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
http://www.research.att.com/~yitzhak
[-- Attachment #2: Type: text/html, Size: 3535 bytes --]
next reply other threads:[~2007-05-30 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-30 15:27 Yitzhak Mandelbaum [this message]
2007-05-30 15:56 ` [Caml-list] " Markus E.L.
2007-05-30 16:46 ` Markus E.L.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7D7BAFC8-9689-4985-B6AE-E83AB95398C4@research.att.com \
--to=yitzhak@research.att.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox