[MLton-devel] Re: finalization in MLton

Matthew Fluet fluet@cs.cornell.edu
Sun, 18 May 2003 08:43:54 -0400 (EDT)


> > The example works with mlton-20030419 but if I try to use yesterdays
> > CVS mlton, then MLton spews tons of SSA SML at me and ends with:
> >       unhandled exception: TypeError
>
> Yes, I see that as well.  Although, it's actually a tone of XML SML.
> We'll look into it.

The following file exhbits Ken's problem:

----
(* zz.sml *)
fun value x =
  let
    exception WRAP of 'a
    fun getVal(WRAP x) = x
    val root = WRAP x
  in
    {value = root, getVal = getVal}
  end
----

SML/NJ accepts the program.  Note that if you modify the function to:

fun value (x:'a) = ...

then the program compiles fine (as does Ken's original).  It seems odd to
me that the type variable 'a can be used in the exception declaration
without any binding occurence, but I don't have a copy of the Def. nearby
to check if that's allowed.  In any event, MLton is raising the error in
XML type-checking.

The reorganization to the (S)XML simplification pipelines I made a couple
of weeks ago exposed the bug, because I modelled it on the SSA
simplification pass that always type-checks the initial and final
programs.  You would be able to break the old code by compiling with
-type-check true.

But, if the program is correct, then it would appear to be a bug in the
type-inference pass.





-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel