Unix.reap (type system obfuscation)

brian <briand-/[email protected]> Fri, 25 May 2007 16:14:35 -0700
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I was trying to ressurect the smltk lib for smlnj since it is  
currently broken.

I found a problem with the following code, I included the original  
comment just in case I am doing the wrong thing.

    (* This shouldn't be here, but SML/NJ implements Unix.reap  
incorrectly--
     * it returns Posix.Process.status whereas it should return
     * OS.Process.Process.status *)

     fun exec (s,sl) =
         let
             val pr = Unix.execute (s,sl)
         in  case (Unix.reap pr) of
              Posix.Process.W_EXITED => true
            | _                      => false
         end

njml.sml:109.6-111.38 Error: case object and rules don't agree [tycon  
mismatch]
   rule domain: ?.POSIX_Process.exit_status
   object: OS.Process.status
   in expression:
     (case (Unix.reap pr)
       of W_EXITED => true
        | _ => false)

That looks easy, all I should have to do is replace  
Posix.Process.W_EXITED with OS.Process.succes, right ?

njml.sml:109.6-111.38 Error: variable found where constructor is  
required: OS.Process.success

Huh ? how is it that OS.Process.success is a variable ?

- OS.Process.success;
[autoloading]
[autoloading done]
val it = 0 : OS.Process.status
-

Isn't it a value ?  More importantly isn't it a variable that matches  
the return type of (Unix.reap pr) ?


I don't understand.  Is it just me, or are the error messages  
misleading ?

Brian


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/