[plt-scheme] curious input phenomenon

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Sun Jan 20 15:23:50 EST 2008

When I run the following program in DrScheme, v372, Pretty Big:

(define (one-last-input)
   (local [(define in (read-char))
           (define (loop-forever)
             (loop-forever))]
     (loop-forever)))

(one-last-input)

it offers me an input box in the Interactions window. I enter some text 
and press Enter. It offers me another box, and keeps doing so until I 
press EOF, at which point it just hangs (predictably). What I don't 
understand is the extra input boxes. Putting a print statement into 
loop-forever seems to indicate that the input boxes are being offered 
concurrently with the execution of the infinite loop. Why is this 
happening? Thanks. --PR

(I discovered this because a student, learning about I/O, wrote a 
program like the previous one except that the infinite loop was an 
accident, not intentional. I could give them a hint as to how to fix 
their program, but I was at a loss to explain the observed behaviour.)


Posted on the users mailing list.