Open greenfork opened 3 years ago
This works in DrRacket BC but not in DrRacket CS. Really bizarre.
It's never meant to work in command-line REPL. If you take a look at the error message, you will see that it tries to parse your input as a Racket program. E.g.,
parent(A, B)?
is read as:
parent
(A (unquote B))
?
Working in BC but not CS means it's likely a Racket-level bug. cc @mflatt
Looks like the problem is with char-ready?
, which returns differently in BC vs CS.
https://github.com/racket/datalog/blob/master/lang/configure-runtime.rkt#L12
I've pushed a repair for char-ready?
, but I'm skeptical that char-ready?
is ever appropriate in a parser.
(Really, I'm skeptical of almost any program that uses char-ready?
. The CS bug may have gone undetected until now because char-ready?
is so rarely useful.)
It is only here:
And I seem to recall putting it in because when DrRacket does parsing, it doesn't give a port that has an EOF, because there might be more, and if you just do the peek-char
then it will hang. This happened 8 years ago so I only have a vague memory --- https://github.com/racket/datalog/commit/d7c8cdd938cecc976f049b1dd154ae7c581fe9fd
I think DrRacket's REPL can have multiple EOFs (one per interaction). Maybe that's what you're thinking of?
Perhaps?
FWIW I found this EOF protocol to be:
TL;DR it was confusing, I got it working(ish), but then had to abandon it.
Is there another possible protocol?
I think this could be one of a few items on a hypothetical roadmap, "Improving the LOP story for non-sexp langs".
Sounds like a nice thing to sort out!
This issue has been mentioned on Racket Discussions. There might be relevant details there:
https://racket.discourse.group/t/current-read-interaction-returning-eof/1032/1
I'm new, just installed Racket v8.0, trying to follow tutorial https://docs.racket-lang.org/datalog/Tutorial.html.
I expect REPL to print me same results as when I execute code:
but it doesn't happen.
Here is my DrRacket screenshot:
Here is my shell session: