From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA17232 for caml-redistribution; Thu, 8 Jul 1999 03:38:47 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA32328 for ; Fri, 2 Jul 1999 03:30:56 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id DAA29085 for ; Fri, 2 Jul 1999 03:30:52 +0200 (MET DST) Received: from localhost (safran.kurims.kyoto-u.ac.jp [130.54.16.91]) by kurims.kurims.kyoto-u.ac.jp (8.9.1a/3.7W) with ESMTP id KAA18422; Fri, 2 Jul 1999 10:30:40 +0900 (JST) To: mottl@miss.wu-wien.ac.at Cc: caml-list@inria.fr Subject: Re: Sys.argv with interpreter and compiler In-Reply-To: Your message of "Fri, 2 Jul 1999 00:35:44 +0100 (MET DST)" <199907012235.AAA05846@miss.wu-wien.ac.at> References: <199907012235.AAA05846@miss.wu-wien.ac.at> X-Mailer: Mew version 1.93 on Emacs 20.3 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <19990702103052J.garrigue@kurims.kyoto-u.ac.jp> Date: Fri, 02 Jul 1999 10:30:52 +0900 From: Jacques GARRIGUE X-Dispatcher: imput version 980905(IM100) Content-Transfer-Encoding: 7bit Sender: weis From: Markus Mottl > 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 JG