Eli Barzilay | 13 Jan 2010 09:36
Favicon
Gravatar

Thoughts on documentation

On Jan 12, Daniel Herring wrote:
> On Mon, 11 Jan 2010, Eli Barzilay wrote:
> > On Jan 11, Daniel Herring wrote:
> >>>> The third mismatch regards punctuation prefixes.  In CL, the
> >>>> forms generated by backquote and related syntax aren't portably
> >>>> extensible...  In other words, `(foo (backquote-comma bar))
> >>>> doesn't necessarily work.
> >>>> http://www.lispworks.com/documentation/lw50/CLHS/Body/02_dfa.htm
> >>>
> >>> This seems like an issue unrelated to the reader?
> >>
> >> I'm just not sure I can support the syntax; parsing is moot if the reader
> >> cannot return the expression...
> >
> > Can you describe the problem in more details?
> 
> From the CLHS link, "the exact manner in which the Lisp reader will
> parse an expression involving the backquote reader macro is not
> specified".
> [...]

I know about that, but I didn't realize what exactly the issue is...

> Some of your punctuation examples are easy to mimic; the rest are 
> very difficult.
> 
>  <at> 'foo[1 2]  - at ->  '(foo 1 2)
> trivial -- QUOTE is a standard form
> 
>  <at> `foo{bar}  - at ->  `(foo "bar")
>  <at> ,foo{bar}  - at ->  ,(foo "bar")
>  <at> , at foo{bar}  - at ->  , <at> (foo "bar")
> very hard -- need to do something different for each implementation
> 
> Unless someone points me to a clever trick, I think these will
> require interfacing with each reader implementation at a deep level.
> I don't see a way to save work by having the #\ <at>  reader call the #\,
> reader.

Maybe when loading (or when creating the extended readtable on top of
a given one, whatever it may be), make up strings for all the
punctuations: "'x" ",x" etc.  For each one, read from the string, and
pull out the symbol that it should be read as.  This is a little
hackish, but should work.

--

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Gmane