David,
I've also sent this to the mailing list in case any other users have comments.
If you write your own read-eval-print loop using PolyML.compiler, you may want
to treat exceptions raised during the eval stage specially. However you can't
currently stop Poly/ML printing out the exception. It seems appropriate to me
to use negative values of the error depth control to do this.
I get the effect I want with the following patch:
--- mlsource/MLCompiler/COMPILER_BODY.ML- 2006-11-06 13:20:50.000000000 +0000
+++ mlsource/MLCompiler/COMPILER_BODY.ML 2008-02-12 13:22:56.000000000 +0000
@@ -641,14 +641,17 @@
val pstream = prettyPrint (77, lexPrint lex);
in
- ppBeginBlock pstream (3, false);
- ppAddString pstream "Exception-";
- ppBreak pstream (1, 0);
- VALUEOPS.printStruct (exceptionData,
- TYPETREE.exnType, ! errorDepth, pstream, printEnv);
- ppBreak pstream (1, 0);
- ppAddString pstream "raised";
- ppEndBlock pstream ();
+ if ! errorDepth >= 0
+ then (
+ ppBeginBlock pstream (3, false);
+ ppAddString pstream "Exception- ";
+ ppBreak pstream (1, 0);
+ VALUEOPS.printStruct (exceptionData,
+ TYPETREE.exnType, ! errorDepth, pstream, printEnv);
+ ppBreak pstream (1, 0);
+ ppAddString pstream "raised";
+ ppEndBlock pstream ()
+ ) else ();
(* print out timing info *)
printTimes (parseTime,pass2Time,treeTime,codeTime,endRunTime)
I note that the error depth also influences syntax-checking and type-checking
error messages, but I can't see why anyone would want to suppress those.
Regards,
Rob.