GNU bug report logs - #55934
[PATCH] (library ...) form in cond-expand inside R7RS define-library

Previous Next

Package: guile;

Reported by: Mihail Iosilevich <yosik <at> paranoid.email>

Date: Sun, 12 Jun 2022 20:24:03 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55934 in the body.
You can then email your comments to 55934 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#55934; Package guile. (Sun, 12 Jun 2022 20:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mihail Iosilevich <yosik <at> paranoid.email>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 12 Jun 2022 20:24:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mihail Iosilevich <yosik <at> paranoid.email>
To: bug-guile <at> gnu.org
Subject: [PATCH] (library ...) form in cond-expand inside R7RS define-library
Date: Sun, 12 Jun 2022 13:13:32 +0300
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




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 16 Jun 2022 07:38:02 GMT) Full text and rfc822 format available.

Notification sent to Mihail Iosilevich <yosik <at> paranoid.email>:
bug acknowledged by developer. (Thu, 16 Jun 2022 07:38:02 GMT) Full text and rfc822 format available.

Message #10 received at 55934-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mihail Iosilevich <yosik <at> paranoid.email>
Cc: 55934-done <at> debbugs.gnu.org
Subject: Re: bug#55934: [PATCH] (library ...) form in cond-expand inside
 R7RS define-library
Date: Thu, 16 Jun 2022 09:37:37 +0200
Hi,

Mihail Iosilevich <yosik <at> paranoid.email> skribis:

> 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.

That looks reasonable to me.

I added a ChangeLog-style entry and committed it, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Jul 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.