Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: mottl@miss.wu-wien.ac.at
Cc: caml-list@inria.fr
Subject: Re: Sys.argv with interpreter and compiler
Date: Fri, 02 Jul 1999 10:30:52 +0900	[thread overview]
Message-ID: <19990702103052J.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Fri, 2 Jul 1999 00:35:44 +0100 (MET DST)" <199907012235.AAA05846@miss.wu-wien.ac.at>

From: Markus Mottl <mottl@miss.wu-wien.ac.at>
> My explanation may probably be misconceived - maybe "interpreted" means
> "interpreted by the byte code interpreter" to you whereas I use "compiled"
> for byte code and native code and "interpreted" if I call the interactive
> toplevel with a file argument.

I had the same problem as you, and indeed find it disturbing.
Particularly, since there is no way to change the contents of
Sys.argv, this means that you cannot easily use the Arg module in a
caml script. Silly.

> As far as I remember, making OCaml (at least under Unix) a "true"
> scripting-language (=with human-readable "#!"-scripts) is not so easy to
> achieve: only binaries may be used as interpreters of "#!"-scripts, which
> is not currently possible with the way the toplevel "ocaml" is designed -
> it needs to be a byte code file. Are there already any convenient ways
> around this problem?

That part is not really a problem.
ocaml does not need to be a code file. You can perfectly link it with
the -custom option.  This is actually what you do when you add the
Unix library, which is a minimum to write scripts...
I suppose this is Pierre did, and he never realized that there was a
potential problem here.

Actually I use this scripting approach when developping libraries:
this avoids having to compile small test examples.

For scripting, there is however another potential problem: if your
script becomes a bit long, you should really think about compiling it,
typechecking becoming slow.  The multiple VM is useful then.

Regards,

	Jacques
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>




  parent reply	other threads:[~1999-07-08  1:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-27 12:02 Markus Mottl
1999-07-01 17:32 ` Xavier Leroy
1999-07-01 23:35   ` Markus Mottl
1999-07-02  0:39     ` Pierre Weis
1999-07-02  0:53       ` Fabrice Le Fessant
1999-07-05  8:09       ` Sven LUTHER
1999-07-05 10:37         ` Markus Mottl
1999-07-08 23:23           ` Gerd Stolpmann
1999-07-02  1:30     ` Jacques GARRIGUE [this message]
1999-07-02  8:56       ` Markus Mottl
1999-06-29 17:01 Damien Doligez
1999-07-08 11:39 Damien Doligez
1999-07-09  2:25 ` Jacques GARRIGUE

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=19990702103052J.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=mottl@miss.wu-wien.ac.at \
    /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