[plt-scheme] Printing Structures without using custom-write

From: Sam TH (samth at ccs.neu.edu)
Date: Wed Oct 10 15:32:00 EDT 2007

In the implementation of Typed Scheme, I have a large number of
structures, representing types, which have custom printers, via the
custom-write structure property.  Sometimes, however, I'd like to be
able to turn off the use of the custom-write property, and just see
that actual contents of the structures.  However, there doesn't seem
to be a way to do this at the moment.  Have I missed something?

I can think of two possible solutions here:

1. Provide a parameter that controls whether the custom-write property
is considered for the printing of structs.  This would have global
effect, and therefore might not be what you want (it might have
abstraction-breaking effects).

2. Call the custom writer with one additional (maybe optional for
compatibility) argument that does writing, but without using the
custom printer for the particular struct type under consideration.
Then I could implement a parameter that controlled custom printing
just for my structs.  However, this requires more effort on the part
of custom printer authors.

Are there other ideas on how this might work?  Are there other
languages or systems that have encountered this issue, and solved it
nicely?

Thanks,

-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.