1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 07:50:20 +02:00

* session.scm (make-fold-modules): Detect circular references in

module graph.  (Thanks to Matthias Köppe.)
This commit is contained in:
Mikael Djurfeldt 2000-06-20 17:10:34 +00:00
parent 5bc9cbd2d8
commit 9aec475196

View file

@ -264,12 +264,18 @@ The forest traversed is the image of the forest generated by root
modules returned by INIT-THUNK and the generator TRAVERSE.
It is an image under the mapping EXTRACT."
(lambda (fold-module init)
(let rec ((data init)
(modules (init-thunk)))
(do ((modules modules (cdr modules))
(data data (rec (fold-module (extract (car modules)) data)
(traverse (car modules)))))
((null? modules) data)))))
(let* ((table (make-hash-table 31))
(first? (lambda (obj)
(and (not (hash-ref table obj))
(hash-create-handle! table obj #t)))))
(let rec ((data init)
(modules (init-thunk)))
(do ((modules modules (cdr modules))
(data data (if (first? (car modules))
(rec (fold-module (extract (car modules)) data)
(traverse (car modules)))
data)))
((null? modules) data))))))
(define-public (apropos-fold-accessible module)
(make-fold-modules (lambda () (list module))