[MLton] using MLBs for scripting

Stephen Weeks MLton@mlton.org
Wed, 15 Sep 2004 15:11:08 -0700


> I guess, what is lost on me is how "scripting" differs from just
> ordinary usage of MLTon. Do you just want #! to do something
> sensible?

When I say scripting, I mean (at least) the following features, none
of which are available with MLton right now.

1. In a single file, write a whole program (that uses libraries).
2. Use the file as if it were an executable by typing the file
   directly at the command line.
3. Run the file with a small startup time.

(1) is not available because you have to write the MLB stuff that
imports the libraries in one file and the sml code in another file.

(2) is not available because /usr/bin/mlton doesn't do the right
thing.

(3) is not available because we don't have an interpreter or a fast
way of loading libraries.

> Is your goal to eliminate all the sh script wrappers that currently
> invoke MLTon and replace them with an MLton "script"?

No.  Although that might be possible if this line of work goes far
enough.

> I guess, I'm trying to understand what applications really would
> benefit from what's being proposed.

The applications I am thinking of are some of the many where Perl and
Python have proven useful and the three features that I mentioned are
part of the reason.  I encounter a need to write such programs on
almost a daily basis.

> Given a choice between sh programming and programming in SML. I
> suspect "sh" syntax and semantics is far more useful than SML for
> most of what I consider "scripting".

There are many applications where sh is too weak and difficult to use,
but scripting with a more powerful language is useful.  Again, refer
to the Perl and Python worlds for examples.