Hello all, I recently ran up against an issue about modules with circular dependencies while working on PEG stuff. I reduced it to the following test case.
Here is file "test-a.scm": (define-module (test-a) #:use-module (test-b)) (define-syntax hello (syntax-rules () ((hello) "Hello, world!\n"))) And here is "test-b.scm": (define-module (test-b) #:use-module (test-a)) (display (hello)) As you can see, test-a and test-b have a circular dependency in which test-a defines syntax that test-b uses. If I run "guile -L "." -s test-a.scm", I get the error ;;; WARNING: compilation of /Users/noah/Desktop/guile/guile/test-a.scm failed: ;;; key unbound-variable, throw_args ("module-lookup" "Unbound variable: ~S" (hello) #f) Clearly the order of compilation is a problem. So I tried this modified test-a.scm: (define-module (test-a)) (define-syntax hello (syntax-rules () ((hello) "Hello, world!\n"))) (use-modules (test-b)) I moved the reference to test-b to the end, but got the same error. So clearly the module system doesn't like circular dependencies on syntax. I think it probably should understand them. I have a feeling that they don't end up adding complexity to compilation, even though it seems like they would, because in order to compile a module you have to search its dependencies for syntax definitions anyway. However, either way, I don't think this issue is documented in the manual. So what do you all think should happen in this case? Noah