using the ML Kit as front end

Stephen Weeks sweeks@intertrust.com
Mon, 7 Aug 2000 21:53:14 -0700 (PDT)


I am sad to report that my attempts to see if the ML Kit front end could be
stolen and used for MLton have been pretty much a total failure.  When I tried
to compile the whole compiler at once (i.e mlton.sml), the Kit ground for about
30 minutes, reached 500M of VM and I gave up.  When I tried to compile using
separate compilation, I immediately ran into two bugs in their compiler without
it even getting through 1/4 of the compile.  Amazingly enough, they are unable
to type check the following two simple programs.

--------------------------------------------------------------------------------
(* program 1 *)
functor F(structure S: sig type 'a t end) =
   struct
      datatype t = T of u S.t
      withtype u = int
   end
--------------------------------------------------------------------------------
(* program 2 *)
structure S = 
   struct
      datatype 'a t = T of 'a u
      and 'a u = U
   end

functor F() = S
--------------------------------------------------------------------------------

I could work around the first bug (by changing the MLton sources, blech), but I
don't see an easy workaround the second without rewriting a lot of code.  Given
this, I am disinclined to continue further.  Also, given the speed with which
these bugs were found, I am somewhat inclined to believe that if we ever decide
to embark on a new frontend project, we should start with what we've already got
in MLton and do a lot of new code, rather than try and use the Kit.  Sad.