[plt-scheme] Trying to reliably turn a value into a list of snips

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed May 28 17:46:32 EDT 2008


> DrScheme uses the pretty-printer when printing values in order to know 
> what to do with snips that are embedded in other data structures. Is 
> that one of the pieces that you need? Specifically, it overrides hooks 
> to let it control how sub-expressions are printed and if it encounters a 
> snip there, it just inserts (a copy of) the snip into the buffer.
>
> The drscheme:language:add-snip-value is used so that other values can be 
> turned into snips (or so that some snips can be rendered differently 
> when they appear, eg picts are bitmap-ized so that the drawing callbacks 
> don't ever happen on a drscheme thread).

Hi Robby,


Yes, I'm trying to get at the pretty-printer that the RePL uses.  I think 
I might be able to reuse the pretty-printer by using the render-value 
functions from the language support in the "tool.ss" library in 
"drscheme".

But one complication is that my entry point is in the heart of an 
decorated-editor-snip% object.  I'm trying to write a custom snip that 
displays its contents just like the interaction REPL. I'm unfamiliar 
enough with DrScheme's structure that I'm having some trouble getting at 
the language object from my snip's callback...


Posted on the users mailing list.