[MLton-devel] new basis library

Matthew Fluet fluet@CS.Cornell.EDU
Thu, 25 Jul 2002 08:40:06 -0400 (EDT)


> Maybe the right way to solve our problems is by writing a single
> signature describing everything in the basis library (except
> signatures) and expresses exactly the sharing constraints we want.
> Something like
> 
> Then, we can define all the modules within the basis library as we do
> now, and take advantage of type sharing.  And, instead of the
> structure definitions in top-level.sml, we do the following.
> 
> local
>    structure Basis:> BASIS =
>       struct
> 	 datatype bool = datatype bool
> 	 structure Bool = Bool
>          ...
> 	 open BoolGlobal
>          ...
>       end
> in
>    open Basis
> end
> 
> Does this give us what we want?  Does it make it easy to read the
> basis library spec as code for a signature (using sharing instead of
> where)?  It seems nice to me because it is a single opaque match and
> is therefore easy to reason about.  Maybe the basis library spec
> should even include the BASIS signature.

I think this is a good approach.
The only drawback I can think of is with signatures that reference
explicit structures; take, for example, the PACK_WORD signature:

signature PACK_WORD = sig
val bytesPerElem : int
val isBigEndian : bool
val subVec  : Word8Vector.vector * int -> LargeWord.word
val subVecX : Word8Vector.vector * int -> LargeWord.word
val subArr  : Word8Array.array * int -> LargeWord.word
val subArrX : Word8Array.array * int -> LargeWord.word
val update : Word8Array.array * int * LargeWord.word -> unit
end

These Word8Vector.vector, Word8Array.array, and LargeWord.word correspond
to the (non-opaquely matched) structures in scope when PACK_WORD is
defined.  As such, these types won't be equal to their opaquely matched
counterparts in Basis.




-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel