[MLton] Welcome to Dan Wang

Matthew Fluet fluet@cs.cornell.edu
Wed, 3 Mar 2004 18:03:43 -0500 (EST)


> > > In particular I thought there was some code that took a portable graph
> > > description and dumped out one big SML file. This is at least my
> > > recollection last time I talked to Matthias Blume a few years back.
> >
> > You are thinking of  GenSML.gen.
> > That will produce one big SML(/NJ) file for one .cm file.  It's up to you
> > to figure out what other .cm files to GenSML.gen to produce the
> > appropriate imports.  That's where you need more information than
> > CM.Graph.graph gives you, because the imports may be under rebound
> > anchors.
>
> Does GenSML.gen (or any other function) do the renaming that is needed
> to handle export filters?

GenSML.gen does the renaming, although it doesn't handle functors in a
SML compatible way; it will produce
  functor F = G
if you need to export the functor G under the name F.
Also, you'll never get proper export filters in SML; since signatures and
functors must appear at the top-level, you can't ever hide them.  Of
course, if all your sources are using imports and exports correctly, then
the right items will be used.  (GenSML.gen tries to fake this by wrapping
all the source files in a global  "local .. in .. end" block, but that's
pretty easy to fix in the GenSML.gen sources.  The functor problem isn't
as easy, because CM is only tracking the functor namespace items, it
doesn't track the functor signature, which you need to eta-expand the
functor.)