Submodules cause false positive cyclic dependencies errors
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 5.2k
- Forks
- 698
- Avg merge
- 18h 34m
- Merged PRs (30d)
- 5
Description
Given two files with the following contents:
A.rkt:
(module+ foo
(require "B.rkt"))
B.rkt:
(require "A.rkt")
On Racket 6.2.1 I get the following error when running racket A.rkt:
standard-module-name-resolver: cycle in loading
at path: .../A.rkt
paths:
.../A.rkt
.../B.rkt
context...:
standard-module-name-resolver
standard-module-name-resolver
standard-module-name-resolver
The module loader complains of a module dependency cycle, but because of the semantics of submodules there really isn't one. Specifically, B depends on A and A-foo depends on B and A. Therefore it should be possible to load first A and not A-foo, then B, then A-foo. This is not the case.
I've run into this problem several times in circumstances where A is a module in the core of a library I'm writing, B is a module defining some extra functionality in the library, and A-foo is a module testing A using the functionality in B to make the tests easier to write and avoid duplication.
As best as I can understand it, this shouldn't be an error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the A.rkt and B.rkt example with racket A.rkt, then inspect the standard-module-name-resolver entry point named in the error. Trace how the loader handles A, B, and the foo submodule. Done means this dependency arrangement loads without reporting a false cycle while preserving genuine cycle detection.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100