From: ·······@gmail.com
Subject: Could read be made to provide a restart for errors?
Date: 
Message-ID: <1161317455.390532.268020@h48g2000cwc.googlegroups.com>
I've heard that it's possible to hook the lisp reader to control how
tokenization / syntax / etc works. Is there any way to change read so
that when it raises "end-of-file" it can also provide a restart to
continue parsing at the same point? For effeciency's sake, it would be
nice if I didn't have to start over with reading at the beginning of
the stream.

My eventual goal is to be able to write code to read s-exprs from a
socket like so:

(let ((stream (make-socket-stream socket)))
  (handler-bind ((end-of-file
                   (case (socket-select socket :timeout 1000)
                     (t (read-more)) ; invoke restart
                     (nil (error "Timed out")))))
    (read stream)))

Is this is any way possible?