[MLton] a unified approach to constants set on the command line
Stephen Weeks
MLton@mlton.org
Mon, 13 Sep 2004 21:10:15 -0700
In defining the basis library primitives, we use _build_const for the
following
_build_const "Exn_keepHistory": bool;
_build_const "MLton_detectOverflow": bool;
_build_const "TextIO_bufSize": int;
We have hardwired defaults for these in control.sml. We have three
different command-line switches to control these
-exn-history {false|true}
-detect-overflow {true|false}
-text-io-buf-size <n>
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;
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?