[MLton] cvs commit: world no longer contains a preprocessed basis library

Matthew Fluet fluet@cs.cornell.edu
Wed, 10 Dec 2003 17:27:26 -0500 (EST)

> Have you found any other NJ-isms in GenSML?

GenSML.gen has the type {use_toplocal : bool, ...} -> unit.

Setting use_toplocal to true means that  local .. in .. end  will be
inserted at every level; in particular, it means that signature and
functor declarations will be within the scope of a local.

Even if you set use_toplocal to false, GenSML.gen wraps the entire
generated program in a local .. in .. end, so you still end up with
signatures and functors within the scope of a local.

> I am trying to decide
> what to with the mention of cmcat in the MLton User Guide.
> 	http://www.mlton.org/user-guide/Porting_SML_NJ_CM.html
> Since cmcat requires SML/NJ 110.9.1, it's hardly a viable option for
> most people.  I would like to either replace the reference to cmcat
> with a discussion of GenSML, or at least add a paragraph on how to use
> GenSML to port from SML/NJ to MLton.  Matthew, could you write such a
> paragraph?

I'll think about what to say.  Note that GenSML.gen still doesn't produce
a whole program, because it doesn't chase other included CM libraries the
way cmcat would.  Also, because of the way SML/NJ now treats the basis as
just another CM library, we can't just keep chasing imports.

I think the best idea would be to hack GenSML into something that works
essentially like cmcat did.  I've already looked at it a little bit, so it
wouldn't be too hard.  It means that you would get out a single list of
files at the end of the day, with no scoping preservation.  So, you could
change the meaning of a program:

A.cm:  Group
         structure A
         a/a.sml (* defines structure A *)

B.cm:  Group
         structure B
         b/a.sml (* defines structure A *)
         b/b.sml (* defines structure B *)

C.cm:  Group
         structure C
         c/c.sml (* defines structure C, using structure A *)

Z.cm:  Group
         structure Z
         z/z.sml (* defines structure Z, using structures A, B, C *)

Running cmcat on Z.cm would yield

and the structures C and Z would incorrectly use the structure A defined
in b/a.sml.  Running GenSML.sml would do the appropriate renaming to
ensure that a/a.sml's structure A would not be overriden by b/b.sml.