racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
447 stars 94 forks source link

racket/unit behavior "bleeds through" to different file #452

Open jbclements opened 3 years ago

jbclements commented 3 years ago

I just found a fun little bug that appears to go back to at least racket v7.5. It appears that under some circumstances, opening a file not written in the racket/unit language can trigger a warning about missing imports, along with a clearly bogus highlight.

Steps to reproduce: 1) delete your proferences. On MacOS Catalina, go to ~/Library/Preferences, delete org.racket-lang.* 2) Open DrRacket. 3) use flower-l, flower-r to choose "The Racket Language". 4) Enter this program:

#lang scheme/signature

5) Run. 5a) Save the new file to /tmp/zz.rkt. 6) Open a fresh tab. 7) open the stepper/private/view-controller.rkt file (easiest using cmd-shift-o). 8) Find the "import" clause on line 37, comment it out. (See error at bottom.) 9) Save the file. 10) Open the file "xml-sig.rkt" in the same directory. 11) The interactions window should now show the error "#%module-begin: missing an `import' clause in: (#%module-begin)", and the red highlight should highlight part of scheme/signature. (See screenshot.) This state seems clearly wrong to me because the scheme/signature language should not require an import clause, and DrRacket should never highlight just part of an identifier.

Screen Shot 2021-01-17 at 5 34 38 PM
rfindler commented 3 years ago

I think that this is probably a consequence of a bad design decision having to do with how the repl's state is initialized. Specifically we have to choose some language to get a REPL. And the one that was chosen here was racket/unit which needs an import clause. DrRacket runs an empty file in the language to get the REPL.

Probably the way that the initial language is chosen for the REPL should be better.

jbclements commented 3 years ago

Oh, that makes sense.

Actually, after thinking about it a bit, it’s not even clear to me that the interactions window should be active, before you’ve hit Run. But that would be a pretty major change.

John

On Jan 17, 2021, at 6:06 PM, Robby Findler notifications@github.com wrote:

I think that this is probably a consequence of a bad design decision having to do with how the repl's state is initialized. Specifically we have to choose some language to get a REPL. And the one that was chosen here was racket/unit which needs an import clause. DrRacket runs an empty file in the language to get the REPL.

Probably the way that the initial language is chosen for the REPL should be better. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.