conjure icon indicating copy to clipboard operation
conjure copied to clipboard

Conjure wrongly evaluate quoted clause within Racket

Open thanhnguyen2187 opened this issue 2 years ago • 2 comments

Hi.

Thanks a lot for the awesome plugin! I am having a strange bug that comes from Conjure's REPL however:

#lang racket

(define greater-than '(> x 0))
(display greater-than)
; got: (x 0)
; expected: (> x 0)

Firing up Racket REPL within the terminal or racket file.rkt both give me the right result. The error does not reappear with (< x 0) nor (>= x 0).

Can you have a look at it? Again, thanks for the awesome plugin!

thanhnguyen2187 avatar Nov 23 '21 15:11 thanhnguyen2187

I think this is probably the line causing the issue: https://github.com/Olical/conjure/blob/9ed390497a5013aa533a15f5d96f3fb6319b4eb9/fnl/conjure/client/racket/stdio.fnl#L21

(display '(a b c > d e)) also eats up just the symbol > in the list, returning just '(a b c d e). I don't quite know what regex @Olical has put in the prompt pattern there, feels to me like it should be something simpler. The general purpose is to eat the > at the beginning of the prompt on the output, but it's eating up any > in the middle as well it appears.

hi-im-buggy avatar Nov 23 '21 16:11 hi-im-buggy

Ah yes, it's probably that pattern. It's overly complex to deal with Racket's REPL sometimes having a bunch of prefixes like when you "enter" a module (I think, can't quite remember, I don't really use Racket I'm afraid). I think really I want \n instead of \n? at the front but I think there are times where the Racket REPL prints them on the same line or prefixes the line with something else.

I remember using a stricter pattern in the past and it caused issues where some results would never display because I couldn't tell that the REPL had actually responded.

I think the complexity comes from the fact that I'm getting some responses across multiple messages, so each event of output from the REPL isn't always a single line or chunk of lines which makes things tricky. I'll take a look at this soon and see what I can do to either mitigate the REPL behaviour or rethink how I identify REPL prompts and strip them from the output.

Really sorry for the issue but thank you for reporting it well!

Olical avatar Nov 23 '21 18:11 Olical