[MLton] Re: [MLton-commit] r6965

Matthew Fluet fluet at tti-c.org
Tue Nov 4 09:25:33 PST 2008


On Fri, 31 Oct 2008, Ville Laurikari wrote:
> Reverted change done in r6964.  Mere concatenation of the SML files
> won't produce a directly compilable with anything but a trivial flat
> MLB structure.  I suppose it's better to keep the MLB files in there,
> although I fail to see how "-stop sml" is useful with MLB files.

It is true that "-stop sml" is probably an out-dated concept.  I'm not 
sure of the history of the "-stop sml" option; it is present in the 
initial revision of the SVN repository (as imported from the earlier CVS 
repository).

It is also true that "-stop sml" doesn't attempt to reflect the MLB 
scoping into the resulting SML file.  [Indeed, one of the motivations for 
the MLB system is that there is scoping that cannot be reflected into SML; 
for example, signatures and functors can only appear at the top-level in 
SML'97, not within "local .. in .. end" scopes.] On the other hand, prior 
to the MLB system, we used a "poor man's CM" system -- that is, MLton 
interprets CM files as nothing more than an ordered list of SML files, 
albeit with a 'cacheing' behavior so that the files in one CM file are not 
included multiple times.  In that setting, "-stop sml" on a CM file would 
produce a SML file with the same semantics of the CM file (relative to how 
MLton interprets a CM file -- neither would reflect SML/NJ's more 
sophisticated CM semantics).

Also, MLton's treatment of a CM file was to implicitly include the Basis 
Library (and not include the Basis Library in the SML file produced by 
"-stop sml").  On the other hand, MLton's treatment of an MLB file does 
not implicitly include the Basis Library (and, does include the Basis 
Library in the SML file produced by "-stop sml"  if 
"$(SML_LIB)/basis/basis.mlb" is included by the MLB file).

If you have a relatively simple project -- one where the scoping 
introduced by the MLB system isn't used extensively and concatenating all 
the files in the project does preserve the meaning, then the "-stop f" 
option will give you the list of MLB and SML files (in their use order); a 
little grep/sed/xargs/cat piping could be used to produce the SML file 
with all the constituent files concatenated together.



More information about the MLton mailing list