Closed countvajhula closed 2 years ago
I can reproduce this. Even more simply (just to get the racket-send-region
stuff out of the picture):
#lang rhombus
racket-run
.
At REPL prompt, type 1
, press C-j to enter a newline without submitting, and hit RET. That prints 1
.
At REPL prompt, enter 2
. It abends ("Process Racket REPL </var/tmp/> connection broken by remote peer").
This seems to be because at step 1, current-read-interaction
returns syntax for 1
, but at step 2, it returns eof
.
Upon eof
, the Racket Mode REPL exits. (This closes the TCP connection for the REPL. The back end is still running.)
If I try type 1
, press C-j, type 2
, press C-j, and RET -- i.e. the input string "1\n2\n\n"
-- then the next REPL interaction is OK (no eof
).
So it seems like the rhombus reader is handling "1\n\n"
as two reads, a 1
and and eof
? (Which the racket reader does not do. It would read 1
, and read nothing for the \n\n
, skipping them and blocking until something following could be read.)
This seems like a bug or quirk in the rhombus reader? Maybe in command-line racket it is hidden or N/A due to the use (by default) of readline and/or expeditor??
This reminds me of #305 about #lang datalog
, where EOF seemed to be used to mean "expression delimiter" as well as "end of file/input". No one I asked was able to explain why, or how this was supposed to work. For awhile I attempted to support it, but had to stop when adding support for multiple REPLs, whose I/O goes over TCP (and anyway no one seemed to be using datalog with Racket Mode).
If current-read-interaction
can return non-syntax values like something satisfying eof-object?
, it seems like it could return a distinct new value expression-delimiter?
-- the expected handling of which is documented? At least that's my initial idea about this, but I think I probably don't fully understand what problem was trying to be solved by overloading EOF to mean other things, too.
Oh now I remember, there was more discussion here.
I'm not sure this is really the same issue but it seems "adjacent"??
Thank you for looking into this so promptly. Using a different value to avoid conflating true EOF from "expression delimiter" sounds like a good idea. Independently, I verified that this in fact only happens with Rhombus and not with a Racket source buffer, on the same 8.5 REPL (and the new title summarizes the issue well!).
It looks like this will be resolved by changing the rhombus shrubbery lexer to stop doing this: https://racket.discourse.group/t/current-read-interaction-returning-eof/1032
However I'll leave this issue open until that happens and we can confirm all is well.
(I'm still not sure what to do about datalog. If datalog could be modified to return a distinct value meaning "Do X", I'd be happy to modify Racket Mode to handle that value and do X. Meanwhile if it's not really important to anyone, I'm OK not doing anything.)
I noticed https://github.com/racket/rhombus-prototype/commit/3a293448e218b8031506411816b3d3f675aa4ecf from earlier today.
I did raco pkg update rhombus-prototype
.
Now it behaves as expected.
I'm closing this, but if you do not see the same, or have another related problem, of course feel free to re-open this.
Excellent, thank you. I will reopen if I encounter it again 👍
I'm trying out Rhombus, and am attempting to send lines of code for evaluation as regions (via
racket-eval-region
). This works with normal Racket code using a standard 8.3 REPL. But I've configured.rhm
files at a.../rhombus/*
path to use a bleeding edge Racket repo binary as backend. DoingC-c C-r
on a region works the first time, and then repeatingC-c C-r
again causes the REPL to crash:Steps to reproduce:
[Note: if you're running Racket 8.5, it may be worth trying this on a normal Racket buffer first, as it may not be specific to Rhombus (see below for more details)] [Note 2: If it does work fine for Racket 8.5 and you don't have Rhombus installed, the installation steps I followed are: (1) clone the racket/racket repo. (2) Run
make
, (3) [after a couple of hours]bin/raco pkg install rhombus-prototype
, (4) in Racket Mode, use thebin/racket
binary as the backend forsome/path/rhombus
, (5) continue with the steps below]1+4