[plt-scheme] user-extensible graphical "print" format

From: Neil W. Van Dyke (neil at neilvandyke.org)
Date: Sun May 16 14:27:31 EDT 2004

Gregory Cooper <greg at cs.brown.edu> writes at 09:26 16-May-2004 -0400:
> You can define a custom language%, overriding the render-value and
> render-value/format methods.  This is how FrTime displays values that
> change over time (look at frtime-tool.ss in the frtime collection).

That's very useful information, and I'm sure to want to define my own
snip-heavy language at some point.

I'd also like a way to associate a snip constructor with an object type
(struct and object%) as a "graphical print" of that object, which works
in *any* DrScheme language from which that object is exposed.  If not a
snip, then a bitmap.

Better yet, and the rest of this is just wishlist items for DrScheme
implementors to keep in mind...

I'd like DrScheme to have general-purpose struct and object%
field-inspector snips with little turndown boxes like it currently has
for syntax-snip.  My custom "graphical print" would be a snip, drawing
routines, or bitmap, in addition to that.

So, if i had a "barcode" struct that printed as "#<struct:barcode>",
when printed in the DrScheme interactions window, there would be a
little turndown control beside it.  When clicked, the snip would expand
to show the inspectable field names and values (value displays might
have turndown controls themselves).  That would be standard DrScheme
stuff.  Then, if I defined a custom "graphical print" for "barcode"
structs (which rendered the barcode graphically!), DrScheme would use
that in lieu of "#<struct:barcode>" text, and still have the standard
turndown control.

To make this feasible, I imagine the turndowns might have to capture
only a small representation of the field values but not prevent
reclamation of huge amounts of memory if there are many turndown
controls currently in the Interactions window.  Maybe weak references
could be used to permit turndown navigation on a value only if it's not
yet been GC'd (navigation would be in addition to the small
representation we captured).


Posted on the users mailing list.