Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Re:  Sys.argv with interpreter and compiler
@ 1999-06-29 17:01 Damien Doligez
  0 siblings, 0 replies; 13+ messages in thread
From: Damien Doligez @ 1999-06-29 17:01 UTC (permalink / raw)
  To: caml-list

>From: Markus Mottl <mottl@miss.wu-wien.ac.at>

>I just wondered, whether it is intentional behaviour that the array
>of command line arguments ("Sys.argv") is treated exactly the same way
>under the interpreter and within executables.

Do you mean native-compiled executables versus byte-code, or compiled
programs versus the toplevel system ?

If the former, it's a bug.  If the latter, the toplevel was not really
designed for this use, and you can use Sys.interactive to tell which
case you are in.

-- Damien




^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: Sys.argv with interpreter and compiler
@ 1999-07-08 11:39 Damien Doligez
  1999-07-09  2:25 ` Jacques GARRIGUE
  0 siblings, 1 reply; 13+ messages in thread
From: Damien Doligez @ 1999-07-08 11:39 UTC (permalink / raw)
  To: caml-list

>From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>

>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.

Sys.argv is an array, so it is mutable like all other arrays and you
can change its contents.  What's harder to do is to change its length,
although you could do it with Obj.truncate (not recommended in
general, except for people who know what they're doing, as usual with
Obj).

-- Damien




^ permalink raw reply	[flat|nested] 13+ messages in thread
* Sys.argv with interpreter and compiler
@ 1999-06-27 12:02 Markus Mottl
  1999-07-01 17:32 ` Xavier Leroy
  0 siblings, 1 reply; 13+ messages in thread
From: Markus Mottl @ 1999-06-27 12:02 UTC (permalink / raw)
  To: OCAML

Hello,

I just wondered, whether it is intentional behaviour that the array
of command line arguments ("Sys.argv") is treated exactly the same way
under the interpreter and within executables.

E.g. I want to emit an error message that includes the name of the
executable or, if the interpreter is used, the name of the script.

Wouldn't it be logically more consistent to pass the truncated array
of arguments to the script under the interpreter so that the program
always gets its name on index 0 - no matter whether it is compiled
or interpreted? - With the current version it gets the name of the
interpreter on this position.

Best regards,
Markus Mottl

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1999-07-10 18:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-29 17:01 Sys.argv with interpreter and compiler Damien Doligez
  -- strict thread matches above, loose matches on Subject: below --
1999-07-08 11:39 Damien Doligez
1999-07-09  2:25 ` Jacques GARRIGUE
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
1999-07-02  8:56       ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox