[plt-scheme] curious input phenomenon

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Sun Jan 20 16:29:01 EST 2008

Chongkai Zhu wrote:

> The following code explains it better:
> 
> (define (one-last-input)
>  (local [(define in
>            (begin0 (read-char)
>                    (print "\n")))
>          (define (loop-forever)
>            (loop-forever))]
>    (loop-forever)))
> 
> (one-last-input)

Once I do a read, the input window is always there. I thought it 
disappeared and reappeared for the next read, but it doesn't. This code 
makes that clear:

(read-char)
(sleep 10)
(printf "hi\n")
(read-char)

If I type "test" into the window, the #\t value appears, and the input 
box hangs around. Ten seconds later, the "hi" appears, then the #\e, and 
the input box disappears as the prompt reappears.

Mystery solved. Thanks. --PR


Posted on the users mailing list.