Fri 11 Jun 2010 03:31:13 PM UTC, original submission:
Define the auxiliary procedure:
(define (submodules m)
(hash-map->list list (module-submodules m)))
which just extracts a list of submodules of `m'. Now apply it to the '(guile) module:
(define gm (resolve-module '(guile) #f))
(submodules m)
this evaluates to a duplicate submodule with different names:
((%app #<module (%app) 84e7c60>) (app #<module (%app) 84e7c60>))
Asking for the submodules of either one of those gives:
(define (submodules* m) (cdr (submodules m)))
(submodules* (car (submodules* m)) => (#<module () 84e7ea0>)
and getting the submodules of this last one, one obtains the list of top level modules, which again includes `gm'. That means that the module tree isn't actually a tree, but a DAG, which sounds weird to me (and will most probably provoke infinite loops in module folders).
Also, the duplicated submodule of '(guile) seems an implementation detail accidentally leaked (hiding it would break the cycle).
|