[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PRINT/READ inversion



Besides printing/reading code (and how many people use #.(MAKE-ARRAY ...)
to make random constants in their code? hopefully not too many), what other
applications were there for printing/reading strings? Many things (the
LispM patch file directories come to mind as a simple example) save strings
as a way of saving objects whose only property is printed representation.
Such things are safe to print with "...". I bet people don't do much saving
of strings that have hairy parts ... eg, who would ever want to save out 
ZWEI line objects to a file and read them back in? I'm curious if anyone has
ever had need in some real program for writing out strings which had hairy 
attributes and reading them back in... Without real cases to ponder over,
it's hard to be sure I'm thinking about the right issues.

Also, it occurred to me that the syntax "..." might be a good printed
syntax for `simple' strings and that #"..." might be a good syntax for 
strings whose printed representation didn't show the whole story and therefore
should be read errors on input (eg, like ZWEI's line objects). This would
leave people with the problem of coming up with another syntax for bit
strings so maybe it's a bad idea.

-kmp

ps for those not familiar with ZWEI, the LispM's editor, it stores editor
   buffers essentially by doubly-linked chains of strings. The array leader
   of each line in the buffer contains a slot for a pointer to the line 
   object which is the previous line and another for the following line,
   so that by doing clever references to array leaders you can essentially
   cdr your way forward or backward through the buffer. The problems involved
   in writing a printer -- even one using #.(...) -- which could print out
   these objects in a truly READ-invertable form would be tremendous because
   of the odd kinds of circularities present; the structure is obviously 
   quite circular.