GNU bug report logs - #40252
[R7RS] cond-expand in define-library forms

Previous Next

Package: guile;

Reported by: Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>

Date: Fri, 27 Mar 2020 15:38:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

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 40252 in the body.
You can then email your comments to 40252 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#40252; Package guile. (Fri, 27 Mar 2020 15:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 27 Mar 2020 15:38:02 GMT) Full text and rfc822 format available.

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

From: Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [R7RS] cond-expand in define-library forms
Date: Fri, 27 Mar 2020 15:17:45 +0100
[Message part 1 (text/plain, inline)]
The following valid R7RS library definition is not handled correctly by
Guile:

(define-library (guile-test)
  (export fold)
  (cond-expand
    ((library (scheme list))
     (import (scheme list)))
    ((library (srfi srfi-1))
     (import (srfi srfi-1)))))

This is what I get:

$ guile --r7rs -L .
GNU Guile 3.0.1
...
> (import (guile-test))
While compiling expression:
no code for module (scheme list)
>

Thus, the cond-expand library declaration does not seem to be handled
correctly. Other experiments with cond-expand also show strange behaviors:

(define-library (guile-test)
  (export foo)
  (cond-expand
    (guile
     (import (scheme base))))
  (begin
    (define foo 42)))

> (import (guile-test))
While compiling expression:
Syntax error:
unknown location: source expression failed to match any pattern in form
(((begin (define foo 42))))

--

Marc
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#40252; Package guile. (Thu, 07 May 2020 17:31:01 GMT) Full text and rfc822 format available.

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

From: Adam Nelson <adam <at> nels.onl>
To: 40252 <at> debbugs.gnu.org
Subject: [PATCH] [R7RS] cond-expand in define-library forms
Date: Thu, 7 May 2020 13:26:25 -0400
It looks like this bug was caused by a missing dot in a list in the 
cond-expand macro. This small patch fixes it:

diff --git a/module/ice-9/r7rs-libraries.scm 
b/module/ice-9/r7rs-libraries.scm
index 6db9de873..221806ad1 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -88,11 +88,11 @@
         (((include-library-declarations filename ...) . decls)
          (syntax-case (handle-includes #'(filename ...)) ()
            ((decl ...)
-            (partition-decls #'(decl ... decls) exports imports code))))
+            (partition-decls #'(decl ... . decls) exports imports code))))
         (((cond-expand clause ...) . decls)
          (syntax-case (handle-cond-expand #'(clause ...)) ()
            ((decl ...)
-            (partition-decls #'(decl ... decls) exports imports code))))))
+            (partition-decls #'(decl ... . decls) exports imports 
code))))))

     (syntax-case stx ()
       ((_ name decl ...)





Information forwarded to bug-guile <at> gnu.org:
bug#40252; Package guile. (Mon, 03 Aug 2020 20:24:01 GMT) Full text and rfc822 format available.

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

From: Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>
To: Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>
Cc: bug-guile <at> gnu.org
Subject: Re: [R7RS] cond-expand in define-library forms
Date: Mon, 3 Aug 2020 22:23:42 +0200
*bump*

Am Fr., 27. März 2020 um 15:17 Uhr schrieb Marc Nieper-Wißkirchen
<marc.nieper+gnu <at> gmail.com>:
>
> The following valid R7RS library definition is not handled correctly by Guile:
>
> (define-library (guile-test)
>   (export fold)
>   (cond-expand
>     ((library (scheme list))
>      (import (scheme list)))
>     ((library (srfi srfi-1))
>      (import (srfi srfi-1)))))
>
> This is what I get:
>
> $ guile --r7rs -L .
> GNU Guile 3.0.1
> ...
> > (import (guile-test))
> While compiling expression:
> no code for module (scheme list)
> >
>
> Thus, the cond-expand library declaration does not seem to be handled correctly. Other experiments with cond-expand also show strange behaviors:
>
> (define-library (guile-test)
>   (export foo)
>   (cond-expand
>     (guile
>      (import (scheme base))))
>   (begin
>     (define foo 42)))
>
> > (import (guile-test))
> While compiling expression:
> Syntax error:
> unknown location: source expression failed to match any pattern in form (((begin (define foo 42))))
>
> --
>
> Marc




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Sat, 01 May 2021 20:26:02 GMT) Full text and rfc822 format available.

Notification sent to Marc Nieper-Wißkirchen <marc.nieper+gnu <at> gmail.com>:
bug acknowledged by developer. (Sat, 01 May 2021 20:26:02 GMT) Full text and rfc822 format available.

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

From: Andy Wingo <wingo <at> pobox.com>
To: 40252-done <at> debbugs.gnu.org
Subject: Applied
Date: Sat, 01 May 2021 22:25:39 +0200
Thanks for the report and fix, and apologies for the delay!

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 30 May 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 343 days ago.

Previous Next


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