Subject: Re: READ-DELIMITED-FORM
From: Erik Naggum <erik@naggum.no>
Date: 04 Sep 2002 21:43:53 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3240164633704542@naggum.no>

* Tim Bradshaw
| I've been thinking about how to implement this function, and I've convinced
| myself that it's very hard indeed.

  You have asked for hooks into the reader previously, as well, and it is
  something I have wanted for a long time, too.  In particular, I would like
  to stop the reader before it interns a symbol and instead use find-symbol on
  the string to avoid creating a new symbol.  I also think it would be nice to
  make , a non-terminating macro character so you can read back integers like 
  1,073,741,824.

| So, here's what I don't know how to do.

  You do this at too high a level.  You must read a token and intervene before
  it is interpreted as an integer, floating-point number, or symbol.  You will
  find a function that does this in all available Common Lisp implementations.

  I would think that a portable implementation of the reader that is way more
  programmable than the one we have today would be a worthwhile project.  I am
  certainly interested in spending time on it as I want it for my own needs.

| `look for a consing dot' is the hard bit.

  Not at all, but it is hard to do it after the token has been interpreted and
  the information upon which you have to make this decision has been destroyed.

| So I think this is actually very hard.  But I'd be delighted to be
| proved wrong.  Does anyone have any ideas?

  I think the above should remove all the problems you have tried to solve.

| I obviously haven't thought this through very far, and the sketched interface
| above is junk, I think, because it would probably be very hard to implement
| for lots of readers (and also it's just junk anyway), but what I really want
| to have is some way of getting at the reader *before* it does things like
| intern symbols and so on.  That would be such a nice thing to have.

  Very much so.

-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.