mosml

Stephen Weeks MLton@sourcelight.com
Mon, 7 Aug 2000 10:17:34 -0700 (PDT)


I am not so sanguine about using mosml, since I noticed the following
bug within a couple of hours of starting to use it.  I sent the following mail
to Peter.

> I find it strange that program 1 is accepted but program 2 is rejected as type
> incorrect.  I believe that SML allows both.
> 
> (* program 1 *)
> structure S: sig
> 		 datatype t = B of real * string
> 	      end =
>    struct
>       datatype t = B of (real * string)
>    end
> 
> (* program 2 *)
> structure S: sig
> 		 datatype t = A of int | B of real * string
> 	      end =
>    struct
>       datatype t = A of int | B of (real * string)
>    end

I received the following reply.

> > I find it strange that program 1 is accepted but program 2 is
> > rejected as type incorrect.  
> 
> Program 2 is rejected because the signature and the structure differ
> in the B constructor's greediness (are the  constructor arguments
> stored in the same heap object as the constructor tag or not).
> 
> Program 1 is accepted because the greediness mismatch doesn't matter:
> a one-constructor datatype is always represented just as that
> constructor's argument.
> 
> > I believe that SML allows both.
> 
> It does.  But we found it important to preserve the efficiency of
> existing core language programs, not penalizing them for the
> introduction of the module system.

Definitely a bizarre reply given how inefficient mosml is.  Anyawys, I am a bit
worried as to how many of these places there are where they violate the standard
(despite what their manual says).  Anyways, I guess we'll just have to see how
bad it is and how hard it is to patch them up.