[racket-dev] need help with pr-13350: readline busy polling vs callback fix?

From: Danny Yoo (dyoo at hashcollision.org)
Date: Sat Feb 9 14:17:33 EST 2013

On Sat, Feb 9, 2013 at 6:12 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> I can't really help with the other questions, but yes, I expect it is the
> newline after the require. Read doesn't read past that matching paren:


I'm observing that if I try to set the file-stream-buffer-mode during
module-load time, it seems ineffective for readline.  I can observe
this with the following program "rl.rkt" at the console repl.

    https://gist.github.com/dyoo/4743135

If I do:

    slab:Desktop dyoo$ racket
    Welcome to Racket v5.3.2.
    > (require "rl.rkt")
    > (start)

then the port seems ok, and the readlines work.

But if modify rl.rkt by uncommenting the toplevel call to setup-io,
and comment out the setup-io in start,

    https://gist.github.com/dyoo/4746640

then the readline breaks very badly when I do:

    slab:Desktop dyoo$ racket
    Welcome to Racket v5.3.2.
    > (require "rl-broken.rkt")
    > (start)

I observe that sync/enable-break in the readline loop reports that the
port is available, but the underlying C world doesn't think so, hence
rl-callback-read-char blocks when it tries to look at stdin.

So I'm left with a puzzle: why does doing the file-stream-buffer-mode
at require run time not have the same effect as doing it after the
module load?

Posted on the dev mailing list.