On Wed, 16 Sep 2009, David Matthews wrote:
Rob Arthan pointed out that the new behaviour in 5.3 of printing
abstract types isn't always desirable and that it might be useful to
explain how to restore the old behaviour. I've added an entry to the
FAQ http://www.polyml.org/FAQ.html#defaultpretty which includes
instructions on how to install a pretty printer that just prints as "?".
The paragraph says "This can be included within the abstract type or
outside it." According to what you have explained to me earlier, it
actually depends if opaque signature matching is involved.
Here is a refined example:
structure Test :>
sig
type T
val x: T
exception Err of T
val bad: unit -> 'a
end =
struct
datatype T = T of int;
val x = T 42;
exception Err of T;
fun bad () = raise Err x;
val _ =
PolyML.addPrettyPrinter (fn _ => fn _ => fn (_: T) => PolyML.PrettyString
"<inner>");
end;
val _ =
PolyML.addPrettyPrinter (fn _ => fn _ => fn (_: Test.T) => PolyML.PrettyString
"<outer>");
Now the behaviour is like this:
ML> Test.x;
val it = <outer> : Test.T
ML> Test.bad ();
Exception- Err of <inner> raised
Using plain ":" instead of ":>" above will produce "<outer>" in both
cases.
Makarius
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml