[MLton] cvs commit: major improvements to -show-basis

Stephen Weeks MLton@mlton.org
Mon, 16 Feb 2004 14:53:06 -0800

> So, with the program:
> val b = String.<(1,1)
> I'm guessing that the error
> Error: z.sml 2.9: function applied to incorrect argument
>    expects: [string] * [string]
>    but got: [int] * [int]
>    in: String.< (1, 2)
> is picking up the "string" from the STRING and BASIS signatures, where it
> appears as an explicit type name.

Unfortunately not.  Early on the basis library, we declare

	type string = char vector

And then, when we bind the basis we use
	signature BASIS_2002 =
	   where type string = string

So, it is known in a user program that type string = char vector, as
the following program confirms.

	val _: string -> char vector = fn z => z

I guess this could be considered a bug, if the basis library spec
required the types to not be equivalent.  But I don't see an easy way
to change this.

In any case, the code to print char vector as string is definitely
used.  Another way to see that is to compile the following with

	val v: char vector = Vector.tabulate (100, fn _ => #"a")