How can I prettyprint a reference value so that I get some idea from looking at the output whether two such values are the same or not?
I have a data type that is littered with various references, and the default pretty-printer only gives me strings with "ref" through them. If I have "ref 1" in one place and "ref 1" in another, I have no idea whether or not these are the same references.
If I want to handle this situation in pure SML, it seems as if I'd have to maintain a global list of seen references and look each reference up by doing a linear search through the list. This is pretty awful. Even if there was a Ref.compare function so that I could avoid linear search, the table would still need to be global so that successive pretty-prints would continue to make sense with respect to each other.
In Moscow ML there is an Obj.magic function that will turn anything into anything, and in particular seems happy to turn a ref into an integer. Is there something comparable in Poly/ML?
(I browsed the poly sources in a very cursory fashion and discovered RunCall.unsafeCast, but this either gave me a segmentation fault, or seemed to be looking at the values at the other ends of the references when I applied it to them.)
Michael.