[MLton-commit] r5676

Vesa Karvonen vesak at mlton.org
Sun Jun 24 22:11:45 PDT 2007


Fail early.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/cast-real.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/cast-real.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/cast-real.sml	2007-06-25 00:50:45 UTC (rev 5675)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/cast-real.sml	2007-06-25 05:11:44 UTC (rev 5676)
@@ -9,17 +9,18 @@
    structure Word = Word64
    local
       fun cast {size=sizeF, set=setF, get=_   }
-               {size=sizeT, set=_,    get=getT} vF =
+               {size=sizeT, set=_,    get=getT} =
           if C.S.toWord sizeF <> C.S.toWord sizeT then
              raise Fail "CastReal: sizes do not match"
-          else let
-                val objF = C.new' sizeF
-                val objT =
-                    let open C.Ptr in |*! (cast' (inject' (|&! objF))) end
-             in
-                setF (objF, vF)
-              ; getT objT before C.discard' objF
-             end
+          else
+             fn vF => let
+                   open C.Ptr
+                   val objF = C.new' sizeF
+                   val objT = |*! (cast' (inject' (|&! objF)))
+                in
+                   setF (objF, vF)
+                 ; getT objT before C.discard' objF
+                end
       val word64 = {size = C.S.ulonglong,
                     set = C.Set.ulonglong',
                     get = C.Get.ulonglong'}




More information about the MLton-commit mailing list