[MLton] Main.main idiom

Matthew Fluet fluet@cs.cornell.edu
Tue, 7 Sep 2004 18:24:07 -0400 (EDT)


I was recently reminded that I am occasionally bothered by having to
scatter call-main.sml files around to actually create the side effect that
runs the program.  It would be nice to allow something like:

  mlton -mainfn Main.main prog.mlb

There are a variety of main functions one could have,
with corresponding code:

unit -> unit
val () = Main.main ()


unit -> OS.Process.status
val () = OS.Process.exit (Main.main ())


string * string list -> OS.Process.status
val () = OS.Process.exit (Main.main (CommandLine.name (),
                                     CommandLine.arguments ()))