[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Running OCaml scripts from the command line
On Tue, Feb 21, 2012 at 10:16 PM, Sebastian Probst Eide <sebastian.probst.eide@xxxxxxxxx> wrote: > On my machine: > > sjc187n36:test seb$ cat m1.ml > let hello () = Printf.printf "Hello from m1\n" > > sjc187n36:test seb$ cat m2.ml > let _ = M1.hello () > print_endline "Hello world\n" > > sjc187n36:test seb$ ocaml m1.ml m2.ml > sjc187n36:test seb$ > > :( > This is the coherent with the behaviour I have on my mcahine. The file m1.ml has no side-effects (it merely declares a function) hence does nothing when executed. (It is not related to flushing the buffers.) In the man page for ocaml, the [script-file] argument is not given as plural, nor does the explanation about this argument: If a script-file is given, phrases are read silently from the file, errors printed on standard error. ocaml(1) exits after the execution of the last phrase. Hence, you can only give one .ml file. To execute several files, you need to compile. (Which, as noted by thomas, can be quite fast for bytecode compilation.) $ ocamlbuild m2.byte $ ./m2.byte Cheers, -- _______ Raphael
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |