[MLton] mlnlffigen is awesome (was: bootstrap problem)
Matthew Fluet
fluet@cs.cornell.edu
Thu, 18 Aug 2005 15:32:54 -0400 (EDT)
> Quoting Matthew Fluet <fluet@cs.cornell.edu>:
> [...]
> > Alternatively, we could provide a -mlb-path-map <file> flag to the
> > compiler (which would augment (and take precedence over)
> > /usr/lib/mlton/mlb-path-map and .mlton/mlb-path-map), in which case
> > someone could distribute their specialized path map along with their code,
> > and simply use the Makefile to ensure compatibility.
>
> I think that this would make sense. It would probably make it
> reasonably convenient to have multiple builds (e.g. debug,
> release (with assertions, logging, etc... selectively turned
> off)).
An alternate means of acheiving the above without the need to modify
source code is to use the (undocumented) MLton.debug constant.
This constant is normally false, but if you compile with
-const 'MLton.debug true', you get the obvious effect.
If you want finer grained control, you can add your own command line
constants, using the (undocumented) _command_line_const primitive and the
"allowConst" mlb annotation.
myconsts.sml:
structure MyConsts =
struct
val debug = _command_line_const "MyConsts.debug": bool = false;
val assert = _command_line_const "MyConsts.assert": bool = false;
end
myconsts.mlb:
ann "allowConst true" in
myconsts.sml
end