unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#40252: [R7RS] cond-expand in define-library forms
@ 2020-03-27 14:17 Marc Nieper-Wißkirchen
  2020-05-07 17:26 ` bug#40252: [PATCH] " Adam Nelson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Nieper-Wißkirchen @ 2020-03-27 14:17 UTC (permalink / raw)
  To: 40252

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2482 bytes --]

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

* bug#40252: [PATCH] [R7RS] cond-expand in define-library forms
  2020-03-27 14:17 bug#40252: [R7RS] cond-expand in define-library forms Marc Nieper-Wißkirchen
@ 2020-05-07 17:26 ` Adam Nelson
  2020-08-03 20:23 ` bug#40252: " Marc Nieper-Wißkirchen
  2021-05-01 20:25 ` bug#40252: Applied Andy Wingo
  2 siblings, 0 replies; 4+ messages in thread
From: Adam Nelson @ 2020-05-07 17:26 UTC (permalink / raw)
  To: 40252

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






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

* bug#40252: [R7RS] cond-expand in define-library forms
  2020-03-27 14:17 bug#40252: [R7RS] cond-expand in define-library forms Marc Nieper-Wißkirchen
  2020-05-07 17:26 ` bug#40252: [PATCH] " Adam Nelson
@ 2020-08-03 20:23 ` Marc Nieper-Wißkirchen
  2021-05-01 20:25 ` bug#40252: Applied Andy Wingo
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Nieper-Wißkirchen @ 2020-08-03 20:23 UTC (permalink / raw)
  To: Marc Nieper-Wißkirchen; +Cc: 40252

*bump*

Am Fr., 27. März 2020 um 15:17 Uhr schrieb Marc Nieper-Wißkirchen
<marc.nieper+gnu@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





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

* bug#40252: Applied
  2020-03-27 14:17 bug#40252: [R7RS] cond-expand in define-library forms Marc Nieper-Wißkirchen
  2020-05-07 17:26 ` bug#40252: [PATCH] " Adam Nelson
  2020-08-03 20:23 ` bug#40252: " Marc Nieper-Wißkirchen
@ 2021-05-01 20:25 ` Andy Wingo
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2021-05-01 20:25 UTC (permalink / raw)
  To: 40252-done

Thanks for the report and fix, and apologies for the delay!

Andy





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

end of thread, other threads:[~2021-05-01 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 14:17 bug#40252: [R7RS] cond-expand in define-library forms Marc Nieper-Wißkirchen
2020-05-07 17:26 ` bug#40252: [PATCH] " Adam Nelson
2020-08-03 20:23 ` bug#40252: " Marc Nieper-Wißkirchen
2021-05-01 20:25 ` bug#40252: Applied Andy Wingo

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