ocsigen/js_of_ocaml — pull request #195 by m2ym (2014-07-12 04:21:41+00:00)
Title: Fix the runtime implementation of Sys.argv in node

Suppose we have argv.ml like:

let () = Array.iter print_endline Sys.argv

The standard byte-code interpreter, ocamlrun, doesn't include
its program name at the first of Sys.argv,

$ ocamlc argv.ml -o argv.out
$ ./argv.out foo bar
argv.out
foo
bar
$ ocamlrun argv.out foo bar
argv.out
foo
bar

but the current implementation of Sys.argv in nodejs does as follows:

$ js_of_ocaml argv.out
$ node argv.js foo bar
node
argv.js
foo
bar

It is not a wrong behavior in general, but it is inconvenient to make
the program work both on ocamlrun and nodejs.