<div dir="ltr">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:<div><br></div><div><div>Welcome to Racket v5.3.3.1.</div>
<div>> (define p (open-input-string "()\n"))</div><div>> (read p)</div><div>'()</div><div>> (peek-char p)</div><div>#\newline</div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Feb 8, 2013 at 11:09 PM, Danny Yoo <span dir="ltr"><<a href="mailto:dyoo@hashcollision.org" target="_blank">dyoo@hashcollision.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">><br>
> However, when I try using this in the larger context of xrepl, I've<br>
> found that I've completely broken it.<br>
><br>
> #######<br>
> $ ~/local/racket/bin/racket<br>
> Welcome to Racket v5.3.3.1.<br>
>> (require xrepl)<br>
> -> hello<br>
> -> world<br>
> -> help<br>
> #######<br>
<br>
<br>
<br>
</div>There's something funny with buffered input going on. If I do the<br>
following interaction on my pr-13350 branch, then the results are much<br>
better:<br>
<br>
#################################<br>
128-110-82-95:readline dyoo$ ~/local/racket/bin/racket<br>
Welcome to Racket v5.3.3.1.<br>
> (file-stream-buffer-mode (current-input-port) 'none)<br>
> (require xrepl)<br>
-><br>
1<br>
1<br>
-> 2<br>
2<br>
-> 3<br>
3<br>
#################################<br>
<br>
<br>
So part of the problem I'm running into seems related to how Racket is<br>
block-buffering the standard input port. This probably messes with<br>
readline, which needs to look at the raw stdin object to make sense of<br>
it.<br>
<br>
I'm still very confused! How do FFI-wrapped C functions deal with<br>
standard input? Does that mean that they normally need to access<br>
stdin via Racket itself, since the port is probably eating blocks of<br>
stdin already?<br>
<br>
<br>
<br>
There are still a few oddities.<br>
<br>
* It's off by a little because of the extra newline, which I don't<br>
understand yet. Is that the newline right after the "(require xrepl)"<br>
that hasn't been consumed yet?<br>
<br>
* If I try to set file-stream-buffer-mode within an xrepl module, I<br>
see no benefit yet. I seem to have to do this at the REPL, before<br>
loading xrepl. Very confused... :(<br>
<div class="HOEnZb"><div class="h5">_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</div></div></blockquote></div><br></div>