[MLton] Main.main idiom

Daniel C. Wang danwang@CS.Princeton.EDU
Tue, 07 Sep 2004 18:49:49 -0400


If you want it to make easier for SML/NJ hackers to port to MLTon the last 
one is preferable. I think the middle one is consistent with the MoscowML 
idiom. So ideally, you probably want to support both styles. :)

BTW is there a windows style @file feature for the MLton command line? as 
the number of command line options gets larger, I'd perefer to have 
something concise.

Matthew Fluet wrote:

> 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 ()))
> 
> 
> _______________________________________________
> MLton mailing list
> MLton@mlton.org
> http://www.mlton.org/mailman/listinfo/mlton