previous message on MLton installation.

Stephen Weeks sweeks@intertrust.com
Thu, 3 Jun 1999 16:21:10 -0700 (PDT)


--bV3jN85V/X
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


> There were some minor problems with make nj-mlton
> 1) It assumes that sml is aliased to sml-cm (which isn't the case on
> my system).

Fixed.  The makefile now uses sml-cm.

> 2) It seemed to pass the "\" which splits the Main.exportNJ command to sml:
> so I ended up typing in the strings by hand.

Hmmm.  It works for me.  Henry, any ideas?
 
> I also edited bin/mlton to change some paths.

Did you have to change anything other than root or nj?

> The result was a working defunctorizer.

Great.

> I had a problem using it on the TIL benchmark "pia.sml":
> the defunctorizer changed
>    file : outstream
> into 
>    file_n : TextIO.StreamIO.outstream ref
> so I had to go in manually and delete the refs.  Is this a bug or a feature?

Short answer:

This is a bug.  Please replace basis-library/top-level/top-level.sml
with the following file and remake nj-mlton.



--bV3jN85V/X
Content-Type: text/plain
Content-Description: top-level.sml
Content-Disposition: inline;
	filename="top-level.sml"
Content-Transfer-Encoding: 7bit

(* Copyright (C) 1997-1999 NEC Research Institute.
 * Please see the file LICENSE for license information.
 *)
signature ARRAY = ARRAY
signature ARRAY2 = ARRAY2
signature BOOL = BOOL
signature BYTE = BYTE
signature CHAR = CHAR
signature COMMAND_LINE = COMMAND_LINE
signature DATE = DATE
signature GENERAL = GENERAL
signature IEEE_REAL = IEEE_REAL
signature INTEGER = INTEGER
signature INT_INF = INT_INF
signature IO = IO
signature LIST = LIST
signature LIST_PAIR = LIST_PAIR
signature MATH = MATH
signature MONO_ARRAY = MONO_ARRAY
signature MONO_ARRAY2 = MONO_ARRAY2
signature MONO_VECTOR = MONO_VECTOR
signature OPTION = OPTION
signature OS = OS
signature PACK_WORD = PACK_WORD
signature POSIX = POSIX
signature POSIX_ERROR = POSIX_ERROR
signature POSIX_SIGNAL = POSIX_SIGNAL
signature POSIX_PROCESS = POSIX_PROCESS
signature POSIX_PROC_ENV = POSIX_PROC_ENV
signature POSIX_FILESYS = POSIX_FILESYS
signature POSIX_IO = POSIX_IO
signature POSIX_SYS_DB = POSIX_SYS_DB
signature POSIX_TTY = POSIX_TTY
signature REAL = REAL
signature SML90 = SML90
signature STRING = STRING
signature STRING_CVT = STRING_CVT
signature SUBSTRING = SUBSTRING
signature TEXT_IO = TEXT_IO
signature TIME = TIME
signature UNIX = UNIX
signature VECTOR = VECTOR
signature WORD = WORD
   
structure Array: ARRAY = Array
structure Array2: ARRAY2 = Array2
structure Bool: BOOL = Bool
structure BoolArray: MONO_ARRAY = BoolArray
structure BoolArray2: MONO_ARRAY2 = BoolArray2
structure BoolVector: MONO_VECTOR = BoolVector
structure Byte: BYTE = Byte
structure Char: CHAR = Char
structure CharArray: MONO_ARRAY = CharArray
structure CharArray2: MONO_ARRAY2 = CharArray2
structure CharVector: MONO_VECTOR = CharVector
structure CommandLine: COMMAND_LINE = CommandLine
structure Date: DATE = Date
structure General: GENERAL = General
structure IEEEReal: IEEE_REAL = IEEEReal
structure Int: INTEGER = Int
structure Int32: INTEGER = Int32
structure IntArray: MONO_ARRAY = IntArray
structure IntArray2: MONO_ARRAY2 = IntArray2
structure IntVector: MONO_VECTOR = IntVector
structure IntInf: INT_INF = IntInf
structure IO: IO = IO
(* Add the : INTEGER constraint as soon as div and mod are implemented
 * in LargeInt
 *)
structure LargeInt(*: INTEGER *) = LargeInt
structure LargeReal: REAL = LargeReal
structure LargeWord: WORD = Word
structure List: LIST = List
structure ListPair: LIST_PAIR = ListPair
structure Math: MATH = Real.Math
structure Option: OPTION = Option
structure OS: OS = OS
structure Pack32Big: PACK_WORD = Pack32Big
structure Pack32Little: PACK_WORD = Pack32Little
structure Posix: POSIX = Posix
structure Real: REAL = Real
structure RealArray: MONO_ARRAY = RealArray
structure Real64Array: MONO_ARRAY = RealArray
structure RealArray2: MONO_ARRAY2 = RealArray2
structure RealVector: MONO_VECTOR = RealVector
structure SML90:> SML90 = SML90
structure String: STRING = String
structure StringCvt: STRING_CVT = StringCvt
structure Substring: SUBSTRING = Substring
structure SysWord: WORD = SysWord
structure TextIO:> TEXT_IO = TextIO
structure Time: TIME = Time
structure Unix: UNIX = Unix
structure Vector: VECTOR = Vector
structure Word: WORD = Word
structure Word8: WORD = Word8
structure Word8Array: MONO_ARRAY = Word8Array
structure Word8Array2: MONO_ARRAY2 = Word8Array2
structure Word8Vector: MONO_VECTOR = Word8Vector
structure Word32: WORD = Word32

open ArrayGlobal BoolGlobal CharGlobal IntGlobal GeneralGlobal ListGlobal
   OptionGlobal RealGlobal StringGlobal SubstringGlobal TextIOGlobal VectorGlobal
   WordGlobal

local
   structure Top: sig
		     val real: int -> real
		     val <> : ''a * ''a -> bool
		     val vector: 'a list -> 'a vector
		  end =
		  struct
		     val real = real
		     val op <> = op <>
		     val vector = vector
		  end
in
   open Top
end

datatype ref = datatype ref

(*------------------------------------*)
(*            nonstandard             *)
(*------------------------------------*)

signature MLTON = MLTON
structure MLton: MLTON = MLton

signature SML_OF_NJ = SML_OF_NJ
structure SMLofNJ: SML_OF_NJ = SMLofNJ

structure Unsafe: UNSAFE = Unsafe
structure Timer = Timer

--bV3jN85V/X
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


Long answer:

The defunctorizer expands away all type abbreviations.  Older versions
of the defunctorizer used the SML/NJ implementation of the basis
library to build their basis.  New versions use the MLton
implementation of the basis library.  The MLton basis library defines
TextIO.outstream to be (equivalent to) TextIO.StreamIO.outstream ref
(see basis-library/io/text-io.sml) and this type definition was
getting exposed.  The definition should have been hidden with a :>
signature constraint but wasn't.  The file that I sent you has the :>
constraint.

Thus, it was not a bug in the defunctorizer, but in the MLton
implementation of the basis library.  In some sense, it wasn't even a
bug there, because one aspect of the basis library that is not well
specified is the identity of types.  In any case, there are probably
other types in the MLton basis library that are exposed that will
cause a similar problem.  Just let us know and it should be an easy
fix.
--bV3jN85V/X--