racket / drracket

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

racket gives "cycle in loading" error, even though there is no circular dependancy #448

Closed ddevz closed 3 years ago

ddevz commented 3 years ago

Suppose we have 4 modules, which we'll call modules 1t, 1c, 2t and 2c.

module 1t depends on modules 1c and 2c. module 2t also depends on modules 1c and 2c.

you would expect this to work, but try running it will return "standard-module-name-resolver: cycle in loading"

(in this description modules 1t and 2t are the interleaved tests for modules 1c and 2c that have been put in their own module (specifcally to break the circular dependancies that would otherwise happen)

Here is a ridiculously trivial example to demonstrate the problem (tested in drracket 7.2): create a file called "list-of-3-gloobs.rkt":

lang racket

(module+ test (require rackunit) (require "3listable-gloobs.rkt")) (provide list-of-3-gloobs)

(define (list-of-3-gloobs a b c) (list a b c))

(module+ test (require rackunit) (require "3listable-gloobs.rkt") (test-case "my-list" (check-equal? (list-of-3-gloobs (generate-3listable-gloob 1) (generate-3listable-gloob 2) (generate-3listable-gloob 3)) `((1) (2) (3)))))

and a file called "3listable-gloobs.rkt":

lang racket

(module+ test (require rackunit) (require "list-of-3-gloobs.rkt")) (provide generate-3listable-gloob)

(define (generate-3listable-gloob a) (list a))

(module+ test (test-case "my-list" (check-equal? (list-of-3-gloobs (generate-3listable-gloob 1) (generate-3listable-gloob 2) (generate-3listable-gloob 3)) `((1) (2) (3)))))

sorawee commented 3 years ago

IIUC, this is a duplicate of racket/racket#1101

ddevz commented 3 years ago

Wow. that was fast. Thanks for pointing that out. I did search, but default search must only match titles, not bodies.
Should I put future related comments on #1101 thread instead of this one?

rfindler commented 3 years ago

@ddevz can you elaborate on the "lock up" that you reported on the other issue, please?

ddevz commented 3 years ago

By "lock up" I just meant that I hit F5 to run one of the 2 files and it never terminates, it just sits there running forever. I did not mean lockup in the sense that a GUI has a bug that makes you unable to hit the stop button.

It does seem to put a red message at the bottom about the "cycle in loading" sometimes. It seems to happen before i run it sometimes? (can that be right?)

If you want drracket GUI bugs, I can create a new issue that "#lang racket \n (require battle-arena) \n (battlearena-game) crashes the drracket GUI in drracket 7.2 when it attempts to open a new window. :)

(Note: i'm probably using the battle-arena package wrong so i wasn't reporting this)

rfindler commented 3 years ago

Okay, thanks @ddevz . I think this is a duplicate now and I'll close it. Please reopen it if I've gotten that wrong.

sorawee commented 3 years ago

@rfindler in particular, I think the GUI bug is the same as the issue I reported at racket/racket#2681. The issue includes a GIF animation of the problem. @ddevz can you take a look at the GIF and confirm that it's the same?