C5's r7rs cond-expand (library ...) doesn't work the same way as in C6. In C6
it checks if a module is loaded or registered in repository-path. In C5, it
checks if a module is loaded or present in the current directory.
The attached patch aligns C5 r7rs behavior with C6. That does mean it stops
checking the current directory. It may not have to do stop doing that (I'd
leave it to maintainer discretion), but I think the C6 behavior is more
generally useful and less error-prone. I do think it's worth having both do the
same thing in any case.
I discovered this because pebble makes use of this mechanism to compile in
support for inotify and spiffy, which wasn't working in C5.
Diego A. Mundo
--- r7rs-compile-time.scm 2026-09-08 16:15:52.626992949 -0400
+++ /tmp/r7rs-compile-time.scm 2026-09-08 16:11:00.109172080 -0400
@@ -11,8 +11,12 @@
(let* ((name2 (parse-library-name name loc))
(sname2 (symbol->string name2)))
(or (##sys#find-module name2 #f)
- (file-exists? (string-append sname2 ".import.so"))
- (file-exists? (string-append sname2 ".import.scm")))))
+ (let loop ((rp (repository-path)))
+ (and (pair? rp)
+ (let ((p (car rp)))
+ (or (file-exists? (string-append p "/" sname2 ".import.so"))
+ (file-exists? (string-append p "/" sname2 ".import.scm"))
+ (loop (cdr rp)))))))))
(define (process-cond-expand clauses)
;; returns list of forms of successful clause or #f