src/Pure/ML-Systems/polyml-4.0.ML
changeset 10914 aded4ba99b88
parent 10708 1a6348a11489
--- a/src/Pure/ML-Systems/polyml-4.0.ML	Tue Jan 16 00:35:18 2001 +0100
+++ b/src/Pure/ML-Systems/polyml-4.0.ML	Tue Jan 16 00:35:50 2001 +0100
@@ -68,10 +68,11 @@
 
 in
 
-fun use_text print verbose txt =
+fun use_text (print, err) verbose txt =
   let
     val in_buffer = ref (explode txt);
     val out_buffer = ref ([]: string list);
+    fun output () = drop_last_char (implode (rev (! out_buffer)));
 
     fun get () =
       (case ! in_buffer of
@@ -83,11 +84,9 @@
       (case ! in_buffer of
         [] => ()
       | _ => (PolyML.compiler (get, put) (); exec ()));
-
-    fun show_output () = print (drop_last_char (implode (rev (! out_buffer))));
   in
-    exec () handle exn => (show_output (); raise exn);
-    if verbose then show_output () else ()
+    exec () handle exn => (err (output ()); raise exn);
+    if verbose then print (output ()) else ()
   end;
 
 end;