src/Pure/ML-Systems/polyml.ML
changeset 10914 aded4ba99b88
parent 8830 3e95f3a90875
child 11078 c1b32e7124b4
--- a/src/Pure/ML-Systems/polyml.ML	Tue Jan 16 00:35:18 2001 +0100
+++ b/src/Pure/ML-Systems/polyml.ML	Tue Jan 16 00:35:50 2001 +0100
@@ -59,10 +59,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
@@ -74,11 +75,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;