\-RTL and mlton

Stephen Weeks MLton@sourcelight.com
Wed, 19 Sep 2001 15:00:40 -0700


> I've built \-RTL using mlton, but it is useless because there's
> nothing good on the command line.  The doco doesn't say how to use
> a file written with SMLofNJ.exportFn.  Is it the same as MLton.World.save?

Roughly.  Here is the implementation (in src/basis-library/sml-nj/sml-nj.sml).

      fun exportFn (file: string, f) =
	 let open MLton.World OS.Process
	 in case save (file ^ ".mlton") of
	    Original => exit success
	  | Clone => exit (f (getCmdName (), getArgs ()) handle _ => failure)
	 end

So, upon restart, the clone applies the function f to the command name and
command line arguments.

The file.mlton is restarted in the same way as a normal mlton world, either from
the command line like

	foo @MLton load-world file.mlton --

or using MLton.World.load.