[MLton] using MLBs for scripting

Daniel C. Wang danwang@CS.Princeton.EDU
Wed, 15 Sep 2004 22:32:03 -0400


Stephen Weeks wrote:

{stuff deleted}
> 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.

I agree about the three problems that are lacking my only point is that even 
with those three reasons fixed. I'd still prefer to use Python or Perl for 
scripting, purely for syntax issues.

SML even with the three problems fixed as you listed, does not make a very 
good scripting language. Consider transliterating the frist few lines of the 
mlton startup script into SML.

lib='/usr/lib/mlton'
gcc='gcc'
mlton="$lib/mlton-compile"
world="$lib/world.mlton"
nj='sml'
eval `$lib/platform`
njHeap="$lib/mlton.$HOST_ARCH-$HOST_OS"

val lib = "/usr/lib/mlton"
val gcc = "gcc"
val mlton = lib ^ "/mlton-comple"
val world = lib ^ "/world.mlton"
val nj = "sml"
val env = parse (lib ^ "/platform")
val HOST_ARCH = get_env env "HOST_ARCH"
val HOST_OS = get_env env "HOST_OS"
val njHeap = String.concat [lib,"/mlton.",HOST_ARCH,"-",HOST_OS]

I'd prefer the sh syntax rather than the native SML syntax.

This is why I think using SML for scripting isn't worth the trouble. You 
really also need more convient syntax IMNHO for this to work. Maybe, you 
have a different set of scripting applications in mind but SML doesn't seem 
like the right language to me.