I missed something. What is the argument for having MLton.TextIO.mkstemp return only the string? This would be very confusing since the file has been made. Also I don't understand the suffix. I think that the way to go is either string -> string * TextIO.outstream or string -> string * TextIO.instream * TextIO.outstream where the string argument is just like in the C mkstemp, but without the trailing "XXXXXX".