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 CAA27068 for caml-redistribution; Fri, 2 Jul 1999 02:40:12 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA32460 for ; Fri, 2 Jul 1999 02:39:19 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id CAA20898; Fri, 2 Jul 1999 02:39:18 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA28037; Fri, 2 Jul 1999 02:39:16 +0200 (MET DST) From: Pierre Weis Message-Id: <199907020039.CAA28037@pauillac.inria.fr> Subject: Re: Sys.argv with interpreter and compiler To: mottl@miss.wu-wien.ac.at (Markus Mottl) Date: Fri, 2 Jul 1999 02:39:16 +0200 (MET DST) Cc: caml-list@inria.fr In-Reply-To: <199907012235.AAA05846@miss.wu-wien.ac.at> from "Markus Mottl" at Jul 2, 99 00:35:44 am X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > 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? > Using byte code for scripting is not so comfortable and I think that > OCaml would give a wonderful language for "true" scripting... I use a very simple way to achieve this: just tell the unix system to execute the right ocaml interpreter, then I execute the file as usual. For instance: pauillac:~$ cat > essai #!/usr/local/bin/ocaml print_string "Hello world!"; print_newline();; exit 0;; ^D pauillac:~$ chmod a+x ./essai pauillac:~$ ./essai Hello world! Normally I use a special version of ocaml, with the regexp and unix libraries linked, but it's the idea: just write plain caml code and interpret it ! In many cases it is fast enough for what I need! What do you think of this completely interpreted approach ? Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/