[MLton] a unified approach to constants set on the command line

Matthew Fluet fluet@cs.cornell.edu
Tue, 14 Sep 2004 08:31:24 -0400 (EDT)


> I was thinking it would be nice to unify these into a single
> mechanism, which could then be used to define new constants whose
> value can be set on the command line.  So, in the basis library, to
> define the constants and their defaults, we would write
>
> 	_command_line_const "Exn.history": bool = false;
> 	_command_line_const "MLton.detectOverflow": bool = true;
> 	_command_line_const "TextIO.bufSize": bool = false;

I assume you mean

 	_command_line_const "TextIO.bufSize": int = 4096;

(or whatever the default is).

> and then on the command line, to set the constants, we would write
>
> 	-const 'Exn.history true'
> 	-const 'MLton.detectOverflow false'
> 	-const 'TextIO.bufSize 8192'
>
> The dot notation in the constant names is purely convention.
>
> Thoughts?

Sounds good.  -exn-history is the only one I've used before and
-const 'Exn.history true' isn't much longer to type.