[racket-dev] current-read-interaction

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Sep 15 18:40:56 EDT 2011

I guess that you're returning something to DrRacket that it is
interpreting as success and then (perhaps evaluating and) asking the
reader again and again. It is hard to say, tho, without seeing what
honu-read-syntax does. Of course, it could also be a bug somewhere.

Can you make a little program that stands alone that I can try out?
Probably just take the below and change it so that honu-read-syntax is
replaced with whatever it would return in the test case you're trying?


On Thu, Sep 15, 2011 at 5:05 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
> For Honu I set up the `current-read-interaction' procedure to read a string of characters ended by a newline and to parse that with `honu-read-syntax'. This
> leads to two issues
> 1. this works on the command line but in drracket after typing '1' and pressing enter the prompt never comes back and drracket chews up some cpu.
> 2. I wanted to make ctrl-d quit the repl immediately so I look for an eof-object in the stream and if found I try to return #'(exit). The Honu parser gets
> involved at that point so it doesn't quite work, but anyway is that the right strategy?
> Here is my repl reader:
> (define (read-one-line name input)
>  (define quit? #f)
>  (define one-line
>    (with-output-to-string
>      (lambda ()
>        (let loop ()
>          (define next (read-char input))
>          (when (eof-object? next)
>            (set! quit? #t))
>          (when (not (or (eof-object? next)
>                         (char=? next #\newline)))
>            (display next)
>            (loop))))))
>  (if quit?
>    ;; this isn't right, somehow communicate to the system that the repl should close
>    #'(exit)
>    (honu-read-syntax name (open-input-string one-line))))
> (provide configure)
> (define (configure . args)
>  (current-read-interaction read-one-line))
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.