David,

For what it is worth, I have attached a patch that fixes PolyML.install_pp. On reflection, if you withdraw it, I am going to have to write something similar of my own, because I can't see any other way of maintaining compatibility with both Poly/ML and SML/NJ.

Regards,

Rob.
--- mlsource/MLCompiler/VALUE_OPS.ML.orig       2009-12-14 17:39:47.000000000 
+0000
+++ mlsource/MLCompiler/VALUE_OPS.ML    2009-12-14 17:48:09.000000000 +0000
@@ -1689,7 +1689,7 @@
                     fun createPretty depth (elemFns: machineWord) (valToPrint: 
machineWord): pretty =
                     let
                         (* Result stack. This contains open Begins and also 
accumulates the result. *)
-                        val resultStack = ref []
+                        val resultStack = ref [PrettyBlock(0, false, [], [])]
                         (* Add an entry to the top block in the stack. *)
                         fun addEntry p =
                             case ! resultStack of
@@ -1703,7 +1703,7 @@
                         fun addString s =
                             addEntry(PrettyString s)
                         and beginBlock(i: int, b: bool) =
-                            addEntry(PrettyBlock(i, b, [], []))
+                            resultStack := PrettyBlock(i, b, [], []) :: 
!resultStack
                         and break (i: int, j: int) : unit =
                             addEntry(PrettyBreak(i, j))
                         and endBlock () =
@@ -1745,8 +1745,7 @@
                     in
                         pprint (addString, beginBlock, break, endBlock) depth 
processElement valToPrint;
                         case ! resultStack of
-                            [] => PrettyBlock(0, false, [], [])
-                        |   [one] => one
+                            [one] => one
                         |   _ => raise Fail "Incorrect nesting of begin...end 
blocks"
                     end
                 in
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to