This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Circular dependencies in modules


Consider:

bar.scm:
(define-module (bar)
  :use-module (foo))

(define-public b a)
;; eof

foo.scm:
(define-module (foo)
  :use-module (bar))

(define-public a #t)
;; eof

test.scm:
(use-modules (foo))
;; eof

Thus creating a circular dependency of modules.  With Guile-1.3.5 (CVS
as of this weekend), when I do:

guile -s test.scm

I get the completely unintuitive and unhelpful:

ERROR: Unbound variable: a

Which is completely impossible to figure out since if I look at uses of
`a', they are in a module that does the proper include.  A better error
message here would be *much* appreciated.  Ideal something that
describes the circular dependence relationship.

Though this example makes it seem like it'd be completely obvious when
one has a circular dependency, it's definitely not-- I introduced one in 
a mesh of dozens of use-module in Scwm and struggled for a while to try
to understand why I had an unbound variable warning.

Incidentally, the warnings when loading modules *with* real errors are
also in need of improvement, IMO.

Thanks,
Greg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]