[MLton] Added completion to esml-mlb-mode

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Fri, 19 Aug 2005 20:30:34 +0300


Quoting Stephen Weeks <sweeks@sweeks.com>:
> > > I wonder if it would be useful to have MLton spit out all the valid
> > > annotations in response to some command-line switch
> > 
> > I think that this would make sense as a form of self-documentation,
> 
> I've added the expert option -show-anns {false|true}.

I have added support for automatically querying the available
annotations from the compiler to the esml-mlb-mode.

> Currently,
> 
>   mlton -show-anns true
> 
> prints
>   [...]
>   forceUsed {false|true}

This may not be what you want. The forceUsed annotation
doesn't actually allow an argument:

		   parseArgs = fn args' =>
		               case args' of
				  [] => SOME ()
				| _ => NONE},

Below is a trivial patch that changes the output of -show-anns
on forceUsed to

   forceUsed {}

An alternative (perhaps better?) would be to change the syntax
of forceUsed to require an argument (using makeBool). This would
have the advantage of making forceUsed like all the other bool
annotations.

-Vesa Karvonen

Index: mlton/control/control-flags.sml
===================================================================
--- mlton/control/control-flags.sml     (revision 4004)
+++ mlton/control/control-flags.sml     (working copy)
@@ -406,7 +406,7 @@
            makeBool ({name = "deadCode",
                       default = false, expert = false}, ac)
         val (forceUsed, ac) =
-           make ({choices = [false, true],
+           make ({choices = [],
                    default = false,
                   expert = false,
                   toString = Bool.toString,