[MLton] Unsafe Pack{Word,Real}

Matthew Fluet fluet at tti-c.org
Fri Aug 21 05:11:53 PDT 2009


On Thu, 20 Aug 2009, Wesley W. Terpstra wrote:
> Does anyone have an objection to this patch?

The concept is fine, but the implementation ends up duplicating 
significant functionality from the PACK_{REAL,WORD} structures.  It might 
be better to work similar to the way the UnsafeMono{Array,Vector} functors 
work --- rebind elements of an _EXTRA structure:

   functor UnsafePackWord (PW: PACK_WORD_EXTRA) : PACK_WORD =
     structure
       open PW
       val subVec = unsafeSubVec
       val subVecX = unsafeSubVecX
       val subArr = unsafeSubArr
       val subArrX = unsafeSubArrX
       val update = unsafeUpdate
     end

Now, in the original PackWord functor bind the unsafe versions of the 
functions to unsafe* and use them in the safe versions.



More information about the MLton mailing list