[MLton] Re: testing MLton's new front end

Stephen Weeks MLton@mlton.org
Mon, 19 Jan 2004 14:45:38 -0800


Hi Andreas.  

> I appended my set of these special tests, along with an (hopefully) 
> up-to-date conformance table. There aren't too many new tests, relative 
> to what I posted on implementers once.

Thanks very much for running the tests.  I have a few comments (and a
few MLton 20040106 discrepancies) on the conformance table, detailed
below.

> MLton clearly does best now, I'm impressed. I also built Hamlet with it 
> OK. (Well, after changing the -o option to -output, so why that?)

I'm glad Hamlet still builds.  As to -output, we've changed to
consistently use spelled-out options instead of single-letter options.

Here are my comments.

----------------------------------------------------------------------
abstype2.sml

I agree it is a bug that MLton 20040106 accepts this program.  I think
this bug will probably stay, though, since fixing it would cause
problems (seen in all the other compilers except Alice) with
abstype.sml.  I think it is better to err on the side of mistakenly
accepting a few corner cases rather than mistakenly rejecting a few
corner cases.  I guess this is what you chose for Alice too?

----------------------------------------------------------------------
dec-strdec.sml

Here's what MLton 20040106 reports.

Error: dec-strdec.sml 49.13: function applied to incorrect argument
   expects: [int]
   but got: [real]
   in: double 2.0
compilation aborted: elaborate reported errors

MLton rejects B'', but not C', which the comment says must be
rejected, although I don't understand why it must be.

----------------------------------------------------------------------
fun-case.sml

Here's what MLton 20040106 reports.

Error: fun-case.sml 8.14: syntax error: replacing  EQUALOP with  DARROW
compilation aborted: parse reported errors

I have no idea how to get this one right :-(.

----------------------------------------------------------------------
redundant.sml

Here's what MLton 20040106 reports.

Warning: redundant.sml 10.1: function has redundant rules
   rules: f F = 2
   in: f E = 1 | f F = 2 | f _ = 0
Warning: redundant.sml 16.32: handler has redundant rules
   rules: F => ()
   in: ((raise (E))) handle (E) => (()) | (F) => (())

MLton is the only SML compiler I have that reports an warning on line
16, but I'm not clear on what the Definition requires for matches
inside functors where there is potential aliasing of exception
constructors.  Section 4.11, page 28, point 2, says that a warning
must be issued if the match is redundant.  But if the functor is never
applied, then is the match redundant?  What if the functor is applied
to some structures where the exception constructors are aliased, and
other structures where they are not?  Then, the match is clearly not
redundant, unless you consider different duplicates of the functor
body (which is what MLton does).

----------------------------------------------------------------------
replication.sml

Here's what MLton 20040106 reports.

Error: replication.sml 6.23: attempt to replicate non datatype: u
Error: replication.sml 18.27: attempt to replicate non datatype: u
compilation aborted: elaborate reported errors

Nevertheless, your table reports "+".  I believe that this program
should be accepted and have checked in a fix to do so.  So, your "+"
will be right for our next release.

----------------------------------------------------------------------
undetermined.sml

Here's what MLton 20040106 reports.

Error: undetermined.sml 10.5: unable to infer type for a
   type: ??? list ref
   in: val a = ref nil
Error: undetermined.sml 8.15: variable type in structure disagrees with signature
   variable:  a
   structure: [unit] list ref
   signature: [int] list ref
Error: undetermined.sml 15.5: unable to infer type for a
   type: ??? list ref
   in: val a = ref nil
compilation aborted: elaborate reported errors

So, MLton rejects this program.  I don't have any plans to chage this
behavior.  I think this a point of disagreement between you and me and
that you believe the Definition requires the program to be accepted.
In any case, your table gives a MLton a "+" here.

----------------------------------------------------------------------
valrec.sml

Here's what MLton 20040106 reports.

Warning: valrec.sml 6.5: declaration is not exhaustive
   missing pattern: 0
   in: 1 = x 1
unhandled exception: Fail: should not get here!

I understand what the Definition says on this one, but MLton, at least
in 20040106, allows the rebinding of constructors with val rec.  So,
for now, this should be a "-", not a "+".  I will think about whether
and how to make MLton conformant.

----------------------------------------------------------------------

Thanks again for trying out the new MLton.  It was very helpful.