[plt-scheme] snips, snip-classes, and snippy questions.

From: Jordan Johnson (jmj at soe.ucsc.edu)
Date: Thu Jun 15 11:52:08 EDT 2006

Hi all,

Three things I'm not clear on:

I understand from the MrEd docs that, by overring read, a subclass of  
snip-class% tells how to handle the decoding of a snip that's stored  
in encoded form.  Where and how does the ENcoding happen?

For want of examples of the above, I've looked around in the sources  
in collects/ but found two different ways of handling the reading:   
Some snipclasses make a snip with default fields and then call (send  
editor read-from-file stream-in #f), and others do some variation on  
getting and reading a byte stream from the editor stream.  Where is  
the input data format specified (I guess that's the same question as  
above), and is there documentation I'm seriously missing?

Finally, a question about the philosophy of snips:  I'm working with  
compound data structures (basically a graph of structs with string,  
sym, and int fields) whose parts will be viewed in several different  
ways through several different interfaces.  For example, in my  
pasteboard I want the snips to display only a terse label, but  
provide access to the underlying data via callbacks.  Making all the  
fields a part of my snip subclass is what got me into the trouble  
suggested by my questions above; making the snips merely a facade  
that points to the "real" data structure seems to preclude use of the  
built-in encoding facilities by the chicken/egg problem it raises in  
the read method.

So, what is the True Sniply Way here:  maintain (and save/load/etc.)  
a substantial structure in parallel with the snips and pasteboard, or  
roll everything into the snip definitions?

Thanks a bunch!


Posted on the users mailing list.