unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library
@ 2022-06-12 10:13 Mihail Iosilevich
  2022-06-16  7:37 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Mihail Iosilevich @ 2022-06-12 10:13 UTC (permalink / raw)
  To: 55934


Guile (3.0.8) reports a compilation error when cond-expand tries to
check existence of a missing library:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (scheme sort))
                             (import (scheme sort)))))
    While compiling expression:
    no code for module (scheme sort)

It looks like bug #40252 was not fully eliminated.

Also, (library ...) cannot handle module names like (srfi 1), though
(import (srfi 1)) works fine. For example, this code fails:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (srfi 1))
                             (import (srfi 1)))))
    While compiling expression:
    In procedure symbol->string: Wrong type argument in position 1
    (expecting symbol): 1

There are probably other cases when (library ...) and (import ...) does
not work identically: (library ...) uses resolve-interface while
(import ...) uses resolve-r6rs-interface.

This patch fixes both issues.

diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index c4c4da22f..63a300a26 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -55,7 +55,10 @@
           ((not req)
            (not (has-req? #'req)))
           ((library lib-name)
-           (->bool (resolve-interface (syntax->datum #'lib-name))))
+           (->bool
+            (false-if-exception
+             (resolve-r6rs-interface
+              (syntax->datum #'lib-name)))))
           (id
            (identifier? #'id)
            ;; FIXME: R7RS (features) isn't quite the same as

-- 
Mihail Iosilevitch





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-16  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 10:13 bug#55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library Mihail Iosilevich
2022-06-16  7:37 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).