GNU bug report logs - #67412
(resolve-r6rs-interface '(srfi 160 u8) tries to load (srfi srfi-160)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; dated Thu, 23 Nov 2023 19:46:01 UTC; Maintainer for guile is bug-guile@HIDDEN.
Added tag(s) patch. Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 67412 <at> debbugs.gnu.org:


Received: (at 67412) by debbugs.gnu.org; 24 Nov 2023 21:20:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 16:20:56 2023
Received: from localhost ([127.0.0.1]:37343 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6dbb-0005r3-IR
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 16:20:56 -0500
Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:43214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6dbX-0005qc-2M
 for 67412 <at> debbugs.gnu.org; Fri, 24 Nov 2023 16:20:52 -0500
Received: by mail-qt1-x831.google.com with SMTP id
 d75a77b69052e-41cbd2cf3bbso26989531cf.0
 for <67412 <at> debbugs.gnu.org>; Fri, 24 Nov 2023 13:20:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700860840; x=1701465640; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=GQ4RfE/JGzIzHrt8Idl0TL6t+sgCJRCGNyXy0UdsGmY=;
 b=W6wtMT/C68sUArhhN82fuPI1MrL86k2+HZNXkjcXm349flm0z5w7vRyZ8qc8NidNsO
 6A0f5tPnjmNNnAl7IK9xkL/6PdJpL7PLGbfuOHWEUkFsRfd/cHiGr5iw/RrwnuVlZOtk
 nUoB0zJ8Gd8DGggusiQo9FkkVs/m3skH0PDwplP2JaEvUqaBwQluFjWAUKS0IRULUqXe
 4UauS7locygKu8SySd/oToj+meucRi74PP0mKxWnMerxbdXOTn/UB0ACAOcKmyiThfFP
 wzApwQKQm4U+hL82iThM8wBNBhFqlLzLZShCgemM3ZXdq4zVRhIJwZ5PxfuitnQHS2bw
 tzSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700860840; x=1701465640;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=GQ4RfE/JGzIzHrt8Idl0TL6t+sgCJRCGNyXy0UdsGmY=;
 b=JwbFrD0oVDYgRlZC7/bajwVA2EJVjdKrcLftjVKleu58hxc3IviWXYNBc8xy+8mOug
 9KEysKY9dmSjCcyhUKiOI5t1v7pE6dmLXbSxgUV7DyuYBeUljCgoxHLkekjmYxR2w0f+
 N+z/2TQeu2XFqDy1uDryqpZy7m+ZPYV5sG4VcSZLCMsy65cJ30xmEuoyAHzB3FcD6S/I
 5g9waMaP7GkbbTA8ux9yN8sHxd9BEBSLi0zNVlFTkilMGEyLdq4f9nHmbcuco5I+F83m
 WAFdfCNZAK6vsMH7Gs9F6nH74m2OrHyv4yIxe7z5GLZV7pkE6AtZNOTzvvYbQtaRvKGw
 Sa0g==
X-Gm-Message-State: AOJu0YyZ9q/rVNy8lub/yxqWQB24sl/1laWh8QV1yqJ6hMb4ier2xiS9
 WIhIgCmgZ6KQF0rRMaK3l9Xski5ldGI=
X-Google-Smtp-Source: AGHT+IG9ksVPVIRleROy2SMvIqONWib+AdyPusOlLtFxga0md5oun6MgtbCcUUrJlbn89t9DQzHaZQ==
X-Received: by 2002:a0c:e88c:0:b0:67a:92f:f300 with SMTP id
 b12-20020a0ce88c000000b0067a092ff300mr6328076qvo.0.1700860840436; 
 Fri, 24 Nov 2023 13:20:40 -0800 (PST)
Received: from localhost.localdomain (dsl-158-42.b2b2c.ca. [66.158.158.42])
 by smtp.gmail.com with ESMTPSA id
 w28-20020a05620a0e9c00b0077d5d1461aesm1504001qkm.31.2023.11.24.13.20.39
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 24 Nov 2023 13:20:39 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 67412 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] r7rs-libraries: Better support R7RS SRFI library names.
Date: Fri, 24 Nov 2023 16:19:06 -0500
Message-ID: <20231124212033.18967-2-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20231124212033.18967-1-maxim.cournoyer@HIDDEN>
References: <20231124212033.18967-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67412
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* module/ice-9/r6rs-libraries.scm
(resolve-r6rs-interface <srfi-name?>: Relax symbol requirements.
Return a symbol.
<import-spec>: Add a new syntax matching clause to avoid stripping the
3rd identifier in a R7RS SRFI module name.
(library): Move R7RS specifics to...
* module/ice-9/r7rs-libraries.scm (define-library): ... here.
<r7rs-name->r6rs-name, r7rs-import->r6rs-import>: New nested procedures,
used to translate the library name and import sets.
* test-suite/tests/rnrs-libraries.test ("import features")
<"renaming works">: Extend test.
<"import works">: New test.

Fixes: https://bugs.gnu.org/67412
---

Changes in v2:
 - Leave/improve some R7RS SRFI handling in r6rs-libraries, for 'import'
 - New 'import' test

 module/ice-9/r6rs-libraries.scm      | 86 ++++++++--------------------
 module/ice-9/r7rs-libraries.scm      | 48 +++++++++++++++-
 test-suite/tests/rnrs-libraries.test | 12 +++-
 3 files changed, 81 insertions(+), 65 deletions(-)

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index f27b07841..f02b13516 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -44,9 +44,9 @@
   (define (srfi-name? stx)
     (syntax-case stx (srfi)
       ((srfi n rest ...)
-       (and (and-map sym? #'(rest ...))
-            (or (n? #'n)
-                (colon-n? #'n))))
+       (cond ((n? #'n) 'r7rs)
+             ((colon-n? #'n) 'r6rs)
+             (else #f)))
       (_ #f)))
 
   (define (module-name? stx)
@@ -85,10 +85,19 @@
               (module-and-uses mod)))
 
   (syntax-case import-spec (library only except prefix rename srfi)
-    ;; (srfi :n ...) -> (srfi srfi-n ...)
+    ;; XXX: This is R7RS-specific, but it's here since we want the
+    ;; `import' procedure below to accept (srfi 64) as well as
+    ;; (srfi :64).
+    ;;
     ;; (srfi n ...) -> (srfi srfi-n ...)
     ((library (srfi n rest ... (version ...)))
-     (srfi-name? #'(srfi n rest ...))
+     (eq? 'r7rs (srfi-name? #'(srfi n rest ...)))
+     (let ((srfi-n (make-srfi-n #'srfi #'n)))
+       (resolve-r6rs-interface
+        #`(library (srfi #,srfi-n rest ... (version ...))))))
+    ;; (srfi :n ...) -> (srfi srfi-n ...)
+    ((library (srfi n rest ... (version ...)))
+     (eq? 'r6rs (srfi-name? #'(srfi n rest ...)))
      (let ((srfi-n (make-srfi-n #'srfi #'n)))
        (resolve-r6rs-interface
         (syntax-case #'(rest ...) ()
@@ -98,7 +107,7 @@
            ;; SRFI 97 says that the first identifier after the `n'
            ;; is used for the libraries name, so it must be ignored.
            #`(library (srfi #,srfi-n rest ... (version ...))))))))
-    
+
     ((library (name name* ... (version ...)))
      (and-map sym? #'(name name* ...))
      (resolve-interface (syntax->datum #'(name name* ...))
@@ -107,7 +116,7 @@
     ((library (name name* ...))
      (and-map sym? #'(name name* ...))
      (resolve-r6rs-interface #'(library (name name* ... ()))))
-    
+
     ((only import-set identifier ...)
      (and-map sym? #'(identifier ...))
      (let* ((mod (resolve-r6rs-interface #'import-set))
@@ -121,7 +130,7 @@
                      (hashq-set! (module-replacements iface) sym #t)))
                  (syntax->datum #'(identifier ...)))
        iface))
-    
+
     ((except import-set identifier ...)
      (and-map sym? #'(identifier ...))
      (let* ((mod (resolve-r6rs-interface #'import-set))
@@ -182,7 +191,7 @@
              (module-remove! iface from)
              (hashq-remove! replacements from)
              (lp (cdr in) (cons (vector to replace? var) out))))))))
-    
+
     ((name name* ... (version ...))
      (module-name? #'(name name* ...))
      (resolve-r6rs-interface #'(library (name name* ... (version ...)))))
@@ -196,45 +205,11 @@
     (define (sym? stx)
       (symbol? (syntax->datum stx)))
 
-    (define (n? stx)
-      (let ((n (syntax->datum stx)))
-        (and (exact-integer? n)
-             (not (negative? n)))))
-
-    (define (colon-n? x)
-      (let ((sym (syntax->datum x)))
-        (and (symbol? sym)
-             (let ((str (symbol->string sym)))
-               (and (string-prefix? ":" str)
-                    (let ((num (string->number (substring str 1))))
-                      (and (exact-integer? num)
-                           (not (negative? num)))))))))
-
-    (define (srfi-name? stx)
-      (syntax-case stx (srfi)
-        ((srfi n rest ...)
-         (and (and-map sym? #'(rest ...))
-              (or (n? #'n)
-                  (colon-n? #'n))))
-        (_ #f)))
-
     (define (module-name? stx)
-      (or (srfi-name? stx)
-          (syntax-case stx ()
-            ((name name* ...)
-             (and-map sym? #'(name name* ...)))
-            (_ #f))))
-
-    (define (make-srfi-n context n)
-      (datum->syntax
-       context
-       (string->symbol
-        (string-append
-         "srfi-"
-         (let ((n (syntax->datum n)))
-           (if (symbol? n)
-               (substring (symbol->string n) 1)
-               (number->string n)))))))
+      (syntax-case stx ()
+        ((name name* ...)
+         (and-map sym? #'(name name* ...)))
+        (_ #f)))
 
     (define (compute-exports ifaces specs)
       (define (re-export? sym)
@@ -282,17 +257,6 @@
            (import ispec ...)
            body ...))
 
-      ((_ (srfi n rest ... (version ...))
-          (export espec ...)
-          (import ispec ...)
-          body ...)
-       (srfi-name? #'(srfi n rest ...))
-       (let ((srfi-n (make-srfi-n #'srfi #'n)))
-         #`(library (srfi #,srfi-n rest ... (version ...))
-             (export espec ...)
-             (import ispec ...)
-             body ...)))
-
       ((_ (name name* ... (version ...))
           (export espec ...)
           (import ispec ...)
@@ -328,7 +292,7 @@
                  (export! x ...)
                  (@@ @@ (name name* ...) body)
                  ...))))))))
-    
+
 (define-syntax import
   (lambda (stx)
     (define (strip-for import-set)
@@ -343,7 +307,7 @@
          #'(eval-when (expand load eval)
              (let ((iface (resolve-r6rs-interface 'library-reference)))
                (call-with-deferred-observers
-                 (lambda ()
-                   (module-use-interfaces! (current-module) (list iface)))))
+                (lambda ()
+                  (module-use-interfaces! (current-module) (list iface)))))
              ...
              (if #f #f)))))))
diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index 429d82ad9..c6f70d73f 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -103,12 +103,56 @@
          #'(rename (from-identifier to-identifier)))
         (identifier #'identifier)))
 
+    (define (r7rs-name->r6rs-name name)
+      ;; This is a hack to support (srfi N x ...) modules in R7RS.  The
+      ;; longer term solution would be to add support at the level of
+      ;; resolve-interface (bug #40371).
+      (define (n? stx)
+        (let ((n (syntax->datum stx)))
+          (and (exact-integer? n)
+               (not (negative? n)))))
+
+      (define (srfi-name? stx)
+        (syntax-case stx (srfi)
+          ((srfi n rest ...)
+           (n? #'n))
+          (_ #f)))
+
+      (define (make-srfi-n context n)
+        (datum->syntax
+         context
+         (string->symbol
+          (string-append
+           "srfi-"
+           (let ((n (syntax->datum n)))
+             (number->string n))))))
+
+      (syntax-case name (srfi)
+        ;; (srfi n ...) -> (srfi srfi-n ...)
+        ((srfi n rest ...) (srfi-name? #'(srfi n rest ...))
+         #`(srfi #,(make-srfi-n #'srfi #'n) rest ...))
+        (_ name)))
+
+    (define (r7rs-import->r6rs-import import-set)
+      ;; Normalize SRFI names.
+      (syntax-case import-set (only except prefix rename)
+        ((only import-set identifier ...)
+         #`(only #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((except import-set identifier ...)
+         #`(except #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((prefix import-set identifier ...)
+         #`(prefix #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((rename import-set (from-identifier to-identifier) ...)
+         #`(rename #,(r7rs-import->r6rs-import #'import-set)
+                   (from-identifier to-identifier) ...))
+        (_ (r7rs-name->r6rs-name import-set))))
+
     (syntax-case stx ()
       ((_ name decl ...)
        (call-with-values (lambda ()
                            (partition-decls #'(decl ...) '() '() '()))
          (lambda (exports imports code)
-           #`(library name
+           #`(library #,(r7rs-name->r6rs-name #'name)
                (export . #,(map r7rs-export->r6rs-export exports))
-               (import . #,imports)
+               (import . #,(map r7rs-import->r6rs-import imports))
                . #,code)))))))
diff --git a/test-suite/tests/rnrs-libraries.test b/test-suite/tests/rnrs-libraries.test
index 86035e508..0fa7acb5c 100644
--- a/test-suite/tests/rnrs-libraries.test
+++ b/test-suite/tests/rnrs-libraries.test
@@ -205,9 +205,17 @@
   (with-test-prefix "srfi"
     (pass-if "renaming works"
       (eq? (resolve-interface '(srfi srfi-1))
-           (resolve-r6rs-interface '(srfi :1)))
+           (resolve-r6rs-interface '(srfi :1))
+           (resolve-r6rs-interface '(srfi 1)))
       (eq? (resolve-interface '(srfi srfi-1))
-           (resolve-r6rs-interface '(srfi :1 lists)))))
+           (resolve-r6rs-interface '(srfi :1 lists))
+           (resolve-r6rs-interface '(srfi 1))))
+
+    (pass-if "import works"
+      (import (srfi srfi-1))
+      (import (srfi :1))
+      (import (srfi 1))
+      #t))
 
   (with-test-prefix "macro"
     (pass-if "multiple clauses"
-- 
2.41.0





Information forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.

Message received at 67412 <at> debbugs.gnu.org:


Received: (at 67412) by debbugs.gnu.org; 24 Nov 2023 21:20:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 16:20:52 2023
Received: from localhost ([127.0.0.1]:37341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6dbX-0005qn-Ok
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 16:20:52 -0500
Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:53373)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6dbV-0005qY-Nq
 for 67412 <at> debbugs.gnu.org; Fri, 24 Nov 2023 16:20:50 -0500
Received: by mail-qk1-x72e.google.com with SMTP id
 af79cd13be357-77d84f8808dso35520985a.2
 for <67412 <at> debbugs.gnu.org>; Fri, 24 Nov 2023 13:20:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700860839; x=1701465639; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=cSuHVk3r1d54szsBvDBsBL9HBWp10BnbbHHpEBRuw+w=;
 b=iHKfw5dfYUa5FWaAFIoViW3CS0Vc1BKVkw2b/T2G2N23CX/DsiSVfboZFWekSx54Sr
 nSptAXFUruQDUbvur5wrxfxA58Y6PbhQRU9geAeHhdIvLIFLF+HkNaO4bkv6hxjiW8Ok
 CMpY0LU5OHw2IH5lLkR8oiBfnsP8FLvAfQClSsq2POWebpNxTqI06QOi/z6S0rfrzJSB
 c39nMO2wPyZHytXZPLbjomt4WlAyQLIb3ffHZz4Uj5X/PyFM4HAZfxfXUGKcFkBFFJAi
 4o7kwlSfx6C2wVMmTfultdjzyLmlNQHg823uMidT6y6LDGIKP29z8vi/M7J+/6D0/Cl2
 phDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700860839; x=1701465639;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=cSuHVk3r1d54szsBvDBsBL9HBWp10BnbbHHpEBRuw+w=;
 b=bpdRhkqzzvivuR4B6M1j4ENauOtjpo1NovGzybKUpjwLQr2QKGb69+l9Yqa3wMozsD
 Z8AwSkaH9Rx5tG5L6tmYvAf8YepXwhHawKnUyEyV0dhtL1b3f2xyqSJdYVnIzfOos1/j
 7dzAvdgTI2Woqc2/0mIkt4pCQjeWr9ZsVgUCYf2UMiVei8+/AVtfOtBNEnNK6SPHqc6v
 VJAxelMSPXOPf3hTJPmYkUoY3+rIizphHDOeG0Ps8BGDYGhHapsjSXADhUXTNXHDTOXN
 XCx38nxtUownRhqH6FLkOsmA5TrKPRDuPRvAFhp7sVYQwMd+Ysrp6iP8AOpsv3AUkVAU
 5bWA==
X-Gm-Message-State: AOJu0Yzd2jE2LvYDsPZ9Re8uiVu8kdJl31aQbg98nGPD4/ssuxzQHouD
 sOYCW2DR/TsnRzuVItFEWcSxxXSNnKM=
X-Google-Smtp-Source: AGHT+IFDpgZ/15DauNM6Ki+iq8BpccriWYNiKzgSX4XT21ago67Q1/mq3cTLtd/XvFprgN95pMWwpA==
X-Received: by 2002:a05:620a:6844:b0:77d:72c2:8561 with SMTP id
 ru4-20020a05620a684400b0077d72c28561mr4503011qkn.55.1700860838874; 
 Fri, 24 Nov 2023 13:20:38 -0800 (PST)
Received: from localhost.localdomain (dsl-158-42.b2b2c.ca. [66.158.158.42])
 by smtp.gmail.com with ESMTPSA id
 w28-20020a05620a0e9c00b0077d5d1461aesm1504001qkm.31.2023.11.24.13.20.37
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 24 Nov 2023 13:20:38 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 67412 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] Use R7RS 'rename' syntax for exports.
Date: Fri, 24 Nov 2023 16:19:05 -0500
Message-ID: <20231124212033.18967-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67412
Cc: Timothy Sample <samplet@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Timothy Sample <samplet@HIDDEN>

* module/ice-9/r7rs-libraries.scm (define-library): Convert R7RS
exports to R6RS exports before passing them on to 'library'.

Fixes: https://bugs.gnu.org/67255
Reported-by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>.
Modified-by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
---

(no changes since v1)

 module/ice-9/r7rs-libraries.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index 63a300a26..429d82ad9 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -1,5 +1,5 @@
 ;; R7RS library support
-;;      Copyright (C) 2020, 2021 Free Software Foundation, Inc.
+;;      Copyright (C) 2020, 2021, 2023 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -97,12 +97,18 @@
            ((decl ...)
             (partition-decls #'(decl ... . decls) exports imports code))))))
 
+    (define (r7rs-export->r6rs-export export-spec)
+      (syntax-case export-spec (rename)
+        ((rename from-identifier to-identifier)
+         #'(rename (from-identifier to-identifier)))
+        (identifier #'identifier)))
+
     (syntax-case stx ()
       ((_ name decl ...)
        (call-with-values (lambda ()
                            (partition-decls #'(decl ...) '() '() '()))
          (lambda (exports imports code)
            #`(library name
-               (export . #,exports)
+               (export . #,(map r7rs-export->r6rs-export exports))
                (import . #,imports)
                . #,code)))))))

base-commit: d579848cb5d65440af5afd9c8968628665554c22
-- 
2.41.0





Information forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.

Message received at 67412 <at> debbugs.gnu.org:


Received: (at 67412) by debbugs.gnu.org; 24 Nov 2023 16:40:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 11:40:19 2023
Received: from localhost ([127.0.0.1]:37052 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6ZE3-0001H6-9H
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 11:40:19 -0500
Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:59613)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6ZDw-0001GZ-P8
 for 67412 <at> debbugs.gnu.org; Fri, 24 Nov 2023 11:40:16 -0500
Received: by mail-qt1-x830.google.com with SMTP id
 d75a77b69052e-423922b10ffso6942101cf.2
 for <67412 <at> debbugs.gnu.org>; Fri, 24 Nov 2023 08:40:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700844001; x=1701448801; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=knkl8CC+CAugGnEdbzq5HBePGYEzssZL063Km2fg3Yc=;
 b=bOHTMXSplJDY7me/FzYrHbTYFOiRlVRcpwQeY2efJcK7L8fMbNSS9vmPElyayeu2En
 AQKodN2HrnSkVPAr+TS9QysTL3iDDFPLXgPiLFT2BIb65Z0afLu64J1yREUBIDS+pjDW
 rqS40cmJZloM34aVHWzM/LMQcS7cSt2oy0ADdCvr3Xy1LcEtcDtZ3j4u+Lg9YssqQWi/
 J8s/arBRTk1QVMK0/dzF+L8MO6B+c18jSA8ebqvM7EuuyloQIW+hgMoeCI9nvMefH0We
 WtwLt/ydlEny3zZU0PnnrevDaABMURNgsClMPo0+5sg0l9TMraUxfh1VoGetGbGF3/Sn
 LlVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700844001; x=1701448801;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=knkl8CC+CAugGnEdbzq5HBePGYEzssZL063Km2fg3Yc=;
 b=Sbcm0Qbl7GGoRrr6aAWFQmdWa345FnBuMGcQMXpT68HzP7YA+eSX1PwXBJeMOSEaQ9
 dn+mj9CtvJrLzhbDZ9Twj+SmwFCcy+TrDn3JpaxXVGaA6pRQXgGdLRga2+YvTPKpQfR2
 wkfvs/F6mQB7E1XTADJj1RlSY0MCiQ9ArQMBHpL2uCMSuw980kw9snixQ+CxVykr20SF
 mR/A+1IVsqarGVPfgdAzLmiGmL3EyU4xhvAsEjcBuygS/Zal787r2S6pqSZhrZGxip5a
 GipmaXLasRbELw5lYnp9m3je3uiqOaVWHK8UhB+qknE+p4MUjl+AHFYQuVAn/qRMXdLt
 mNoQ==
X-Gm-Message-State: AOJu0Yw+3ZLEq332FgRbZnFmKmbMYo5+5dD+RWCzXxI/zuumlZxkfpqM
 tekSyQfFuCarYpVVDuITP43sdgQ0NaY=
X-Google-Smtp-Source: AGHT+IExssCmXLdmQliGvmsOF5XPxQTkQzopepKsPxUjSZf/93nzKuA8FLl4YWXQ+38sWnWYUEuqNQ==
X-Received: by 2002:ac8:5a11:0:b0:412:1e0a:772a with SMTP id
 n17-20020ac85a11000000b004121e0a772amr4247114qta.17.1700844000715; 
 Fri, 24 Nov 2023 08:40:00 -0800 (PST)
Received: from localhost.localdomain (dsl-158-42.b2b2c.ca. [66.158.158.42])
 by smtp.gmail.com with ESMTPSA id
 ay30-20020a05622a229e00b00423a0d10d4csm128885qtb.62.2023.11.24.08.40.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 24 Nov 2023 08:40:00 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 67412 <at> debbugs.gnu.org
Subject: [PATCH 2/2] r7rs-libraries: Better support R7RS SRFI library names.
Date: Fri, 24 Nov 2023 11:39:30 -0500
Message-ID: <20231124163953.11253-2-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20231124163953.11253-1-maxim.cournoyer@HIDDEN>
References: <20231124163953.11253-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67412
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface)
(library): Move R7RS specifics to...
* module/ice-9/r7rs-libraries.scm (define-library): ... here.
<r7rs-name->r6rs-name, r7rs-import->r6rs-import>: New nested procedures,
used to translate the library name and import sets.
* test-suite/tests/rnrs-libraries.test ("import features"): Add a test.

Fixes: https://bugs.gnu.org/67412
---

 module/ice-9/r6rs-libraries.scm | 25 +++--------------
 module/ice-9/r7rs-libraries.scm | 48 +++++++++++++++++++++++++++++++--
 2 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index f27b07841..78b3dfcfb 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -27,11 +27,6 @@
   (define (sym? stx)
     (symbol? (syntax->datum stx)))
 
-  (define (n? stx)
-    (let ((n (syntax->datum stx)))
-      (and (exact-integer? n)
-           (not (negative? n)))))
-
   (define (colon-n? x)
     (let ((sym (syntax->datum x)))
       (and (symbol? sym)
@@ -45,8 +40,7 @@
     (syntax-case stx (srfi)
       ((srfi n rest ...)
        (and (and-map sym? #'(rest ...))
-            (or (n? #'n)
-                (colon-n? #'n))))
+            (colon-n? #'n)))
       (_ #f)))
 
   (define (module-name? stx)
@@ -63,9 +57,7 @@
       (string-append
        "srfi-"
        (let ((n (syntax->datum n)))
-         (if (symbol? n)
-             (substring (symbol->string n) 1)
-             (number->string n)))))))
+         (substring (symbol->string n) 1))))))
 
   (define (make-custom-interface mod)
     (let ((iface (make-module)))
@@ -86,7 +78,6 @@
 
   (syntax-case import-spec (library only except prefix rename srfi)
     ;; (srfi :n ...) -> (srfi srfi-n ...)
-    ;; (srfi n ...) -> (srfi srfi-n ...)
     ((library (srfi n rest ... (version ...)))
      (srfi-name? #'(srfi n rest ...))
      (let ((srfi-n (make-srfi-n #'srfi #'n)))
@@ -196,11 +187,6 @@
     (define (sym? stx)
       (symbol? (syntax->datum stx)))
 
-    (define (n? stx)
-      (let ((n (syntax->datum stx)))
-        (and (exact-integer? n)
-             (not (negative? n)))))
-
     (define (colon-n? x)
       (let ((sym (syntax->datum x)))
         (and (symbol? sym)
@@ -214,8 +200,7 @@
       (syntax-case stx (srfi)
         ((srfi n rest ...)
          (and (and-map sym? #'(rest ...))
-              (or (n? #'n)
-                  (colon-n? #'n))))
+              (colon-n? #'n)))
         (_ #f)))
 
     (define (module-name? stx)
@@ -232,9 +217,7 @@
         (string-append
          "srfi-"
          (let ((n (syntax->datum n)))
-           (if (symbol? n)
-               (substring (symbol->string n) 1)
-               (number->string n)))))))
+           (substring (symbol->string n) 1))))))
 
     (define (compute-exports ifaces specs)
       (define (re-export? sym)
diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index f8b6b4c59..f2692b833 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -102,12 +102,56 @@
         ((rename internal external) #'(rename (internal external)))
         (_ export)))
 
+    (define (r7rs-name->r6rs-name name)
+      ;; This is a hack to support (srfi N x ...) modules in R7RS.  The
+      ;; longer term solution would be to add support at the level of
+      ;; resolve-interface (bug #40371).
+      (define (n? stx)
+        (let ((n (syntax->datum stx)))
+          (and (exact-integer? n)
+               (not (negative? n)))))
+
+      (define (srfi-name? stx)
+        (syntax-case stx (srfi)
+          ((srfi n rest ...)
+           (n? #'n))
+          (_ #f)))
+
+      (define (make-srfi-n context n)
+        (datum->syntax
+         context
+         (string->symbol
+          (string-append
+           "srfi-"
+           (let ((n (syntax->datum n)))
+             (number->string n))))))
+
+      (syntax-case name (srfi)
+        ;; (srfi n ...) -> (srfi srfi-n ...)
+        ((srfi n rest ...) (srfi-name? #'(srfi n rest ...))
+         #`(srfi #,(make-srfi-n #'srfi #'n) rest ...))
+        (_ name)))
+
+    (define (r7rs-import->r6rs-import import-set)
+      ;; Normalize SRFI names.
+      (syntax-case import-set (only except prefix rename)
+        ((only import-set identifier ...)
+         #`(only #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((except import-set identifier ...)
+         #`(except #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((prefix import-set identifier ...)
+         #`(prefix #,(r7rs-import->r6rs-import #'import-set) identifier ...))
+        ((rename import-set (from-identifier to-identifier) ...)
+         #`(rename #,(r7rs-import->r6rs-import #'import-set)
+                   (from-identifier to-identifier) ...))
+        (_ (r7rs-name->r6rs-name import-set))))
+
     (syntax-case stx ()
       ((_ name decl ...)
        (call-with-values (lambda ()
                            (partition-decls #'(decl ...) '() '() '()))
          (lambda (exports imports code)
-           #`(library name
+           #`(library #,(r7rs-name->r6rs-name #'name)
                (export . #,(map r7rs-export->r6rs-export exports))
-               (import . #,imports)
+               (import . #,(map r7rs-import->r6rs-import imports))
                . #,code)))))))
-- 
2.41.0





Information forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.

Message received at 67412 <at> debbugs.gnu.org:


Received: (at 67412) by debbugs.gnu.org; 24 Nov 2023 16:40:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 11:40:15 2023
Received: from localhost ([127.0.0.1]:37050 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6ZDy-0001Gp-U3
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 11:40:15 -0500
Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:47348)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6ZDu-0001GV-5G
 for 67412 <at> debbugs.gnu.org; Fri, 24 Nov 2023 11:40:13 -0500
Received: by mail-qt1-x82e.google.com with SMTP id
 d75a77b69052e-41cc537ed54so10525061cf.2
 for <67412 <at> debbugs.gnu.org>; Fri, 24 Nov 2023 08:40:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700843999; x=1701448799; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=fzvY7iy61nkb4rEix1zEA+uvhdgDXM9vIPFoKrp3fD0=;
 b=WXPM3j2w62HpoXXI/b1D4HaaUMW6FbGJsf1ZFAtTucFHzAqvMPouf3hEk4ODdyupgu
 NY8+HyBDhXwKecb7dkGbFvcsB0IkIwvegcvc/N6PWXWuQefUr7GaRqavJF4rxvGRMd2w
 zeWtjxBBqDHwAlKl9MhppNEySGKJxAidpBgu24/FSxGE5fA0YrWx0bC6OnsimYNkRvSw
 hndrKpDk29/McCtRySQ3y9qIfWrI+5Tfo0W9ICu/qghgfljdPenKqD4NtMzOdE6xjHJ/
 Ak9ReA3uIYMEv5cFsxDuQQXSq3+yYqRDmHVUozDcqdUXOqlegpaMU2aYvpDGlkG70fLr
 Waeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700843999; x=1701448799;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=fzvY7iy61nkb4rEix1zEA+uvhdgDXM9vIPFoKrp3fD0=;
 b=b0BHpwlElBjQHT+hrYDbd0ALdNsDTG1/7Ic+YgeYfkWV9205uDY3oWfZ7ZuiPy6iMi
 6P81i5pZ+fAGCTV+bXK0SmdzXBgSFDuZom1orprpJMWbjlrdkFa1qZdF/7LMJFe81/Sp
 3v4rTeAefXcUh+te1xCIEQmp+qKEGevyQViafE9lv+D2DaSMXZKjW07Z5LGM/EU/pqJm
 f8YGM7vc3ximDDKGY1jPEPfdfkTNW0yLQtxq2pTqrmXukfCaH0G/8S3c5FUo7Q+yQbva
 EV3lrJkj//FQZ6Pb2PrUe0tA8kR+1TORQm+n9aEfZJdxNY9UWzkbp9OmXnt5/7vo45jL
 3lXw==
X-Gm-Message-State: AOJu0YzyVc/v7bO5LKWHISJ5jU1EBHciamBicOpivcpJiJASwG4sm8Ct
 zvUqfENel1zifB+778aaqL8JwSwt0tg=
X-Google-Smtp-Source: AGHT+IF0Q+pr4BnHjWrFBdyjF/aKv3az/iwQFFlM4H9mCdZWOBOgN0dqkoCrLYGcIguMZMM/hCa7Ew==
X-Received: by 2002:a05:622a:1316:b0:423:83ee:749c with SMTP id
 v22-20020a05622a131600b0042383ee749cmr4327895qtk.57.1700843999386; 
 Fri, 24 Nov 2023 08:39:59 -0800 (PST)
Received: from localhost.localdomain (dsl-158-42.b2b2c.ca. [66.158.158.42])
 by smtp.gmail.com with ESMTPSA id
 ay30-20020a05622a229e00b00423a0d10d4csm128885qtb.62.2023.11.24.08.39.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 24 Nov 2023 08:39:58 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 67412 <at> debbugs.gnu.org
Subject: [PATCH 1/2] Use R7RS 'rename' syntax for exports.
Date: Fri, 24 Nov 2023 11:39:29 -0500
Message-ID: <20231124163953.11253-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67412
Cc: Timothy Sample <samplet@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Timothy Sample <samplet@HIDDEN>

* module/ice-9/r7rs-libraries.scm (define-library): Convert R7RS
exports to R6RS exports before passing them on to 'library'.

Fixes: https://bugs.gnu.org/67255
Reported-by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>.
---

 module/ice-9/r7rs-libraries.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index 63a300a26..f8b6b4c59 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -1,5 +1,5 @@
 ;; R7RS library support
-;;      Copyright (C) 2020, 2021 Free Software Foundation, Inc.
+;;      Copyright (C) 2020, 2021, 2023 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -97,12 +97,17 @@
            ((decl ...)
             (partition-decls #'(decl ... . decls) exports imports code))))))
 
+    (define (r7rs-export->r6rs-export export)
+      (syntax-case export (rename)
+        ((rename internal external) #'(rename (internal external)))
+        (_ export)))
+
     (syntax-case stx ()
       ((_ name decl ...)
        (call-with-values (lambda ()
                            (partition-decls #'(decl ...) '() '() '()))
          (lambda (exports imports code)
            #`(library name
-               (export . #,exports)
+               (export . #,(map r7rs-export->r6rs-export exports))
                (import . #,imports)
                . #,code)))))))

base-commit: d579848cb5d65440af5afd9c8968628665554c22
-- 
2.41.0





Information forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.

Message received at 67412 <at> debbugs.gnu.org:


Received: (at 67412) by debbugs.gnu.org; 23 Nov 2023 21:45:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 23 16:45:09 2023
Received: from localhost ([127.0.0.1]:35268 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6HVU-0001Ip-OK
	for submit <at> debbugs.gnu.org; Thu, 23 Nov 2023 16:45:09 -0500
Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]:55450)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6HVS-0001Ho-5s
 for 67412 <at> debbugs.gnu.org; Thu, 23 Nov 2023 16:45:07 -0500
Received: by mail-qv1-xf2b.google.com with SMTP id
 6a1803df08f44-67a0836e635so4441086d6.2
 for <67412 <at> debbugs.gnu.org>; Thu, 23 Nov 2023 13:45:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700775896; x=1701380696; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=QkgJS0lIpk0ev6Kihr8zFK+38TucxbJafNJn4w6Urig=;
 b=QCPRIr8R4ZkTJBY2sChfT/IHOXS/BbQOC77UvTnOKh7LC5yQHgbLJFIM2E3eqbomtX
 Ln5yuCgDl40nLyD8702sIJZl3EnBLftk0fvqWGfQyximYuhTA6TUUSPW7203uoYclf56
 pWEnMCaG9XtW/fqZl5JawUew1NC9zVbThO/IA8cFqXkKuevTZMbWduUTanLD+ritLRlp
 NUvu47nLpB3LZS3uZUlU6WWdLKVrpwhr/4H1DWT4z5tLtLVZ1RtjhtsbBuGlx1iNKoB2
 Ab8eKwNFQp+XNSm8gtEEUh0nEKdArjvF3b0xF/xu3ek1UWL3JY/pdhGV6ghz2+YTHsrS
 1EOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700775896; x=1701380696;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=QkgJS0lIpk0ev6Kihr8zFK+38TucxbJafNJn4w6Urig=;
 b=pRWFRpEdY0c266gWEf8AY/Ov5EOFRppT58ToaZoA76RQwJ1BBqZ0ZiBh7YvjYQ3Wh5
 9h3LudZaCW1fKthsFYDyKGaQH0FoDJoiWTkPwmw+iaFjCuX7k1UXnT9HkgYpOARfDnpV
 PAeryaO5miu1/4+sV0r9Nesb/T3BgTrlvI9o/hrId9l63njakt4v446K92aGfvIAtoMQ
 c965VW7byGZtkO3V4U4E/ddhFvtr3qavfVqGjuZZV3ohmDAo6lYHtGn4u/FK9vGWIJjr
 SpXYpGsEIlegfuIotC8qQYEBZWoxSWM8ERfHqWcyROoxx0GSPVcvnGJg3+5klLu969IC
 e//g==
X-Gm-Message-State: AOJu0Yyi0977rWvtuRpXXdreR1uAwZaDBjlS7Mke897Bk9jM2O4lBjqt
 fS1RrRa/Ql/JUIF6mfrYrCeyEWtK+dE=
X-Google-Smtp-Source: AGHT+IHq13R0H4iEBeQ1xHXjZON0xLXu0nyluUkDAS3pHa01UH0raTDB8dxShhjok2wLBphUkJ6wlQ==
X-Received: by 2002:a0c:e60e:0:b0:67a:faa:97a0 with SMTP id
 z14-20020a0ce60e000000b0067a0faa97a0mr866082qvm.50.1700775896130; 
 Thu, 23 Nov 2023 13:44:56 -0800 (PST)
Received: from hurd (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102])
 by smtp.gmail.com with ESMTPSA id
 n12-20020a0ce48c000000b0066d23395d27sm823438qvl.123.2023.11.23.13.44.55
 for <67412 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Nov 2023 13:44:55 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 67412 <at> debbugs.gnu.org
Subject: Re: bug#67412: (resolve-r6rs-interface '(srfi 160 u8) tries to load
 (srfi srfi-160)
In-Reply-To: <87o7fk6yp8.fsf@HIDDEN> (Maxim Cournoyer's message of "Thu, 23
 Nov 2023 14:45:23 -0500")
References: <87o7fk6yp8.fsf@HIDDEN>
Date: Thu, 23 Nov 2023 16:44:54 -0500
Message-ID: <87il5s6t61.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67412
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Investigating, I've found this:

--8<---------------cut here---------------start------------->8---
trace: |  (_ #<procedure 7fc0c55af068 at ice-9/r6rs-libraries.scm:104:5 (n =
rest version)> (160 (u8) ()))
trace: |  (_ 160 (u8) ())
trace: |  |  (syntax->datum 160)
trace: |  |  (strip 160)
trace: |  |  |  (syntax? 160)
trace: |  |  |  #f
trace: |  |  160
trace: |  |  (number->string 160)
trace: |  |  "160"
trace: |  |  (string-append "srfi-" "160")
trace: |  |  "srfi-160"
trace: |  |  (datum->syntax #<syntax:r6rs-libraries.scm:92:34 srfi> srfi-16=
0)
trace: |  |  |  (syntax-wrap #<syntax:r6rs-libraries.scm:92:34 srfi>)
trace: |  |  |  ((top) #(ribcage #(n rest version) #((top) (top) (top)) #("=
l-680b775fb37a463-160b" "l-680b775fb37a463-160c" "l-680b775fb37a463-160d"))=
 #(ribcage (module-for-each/nonlocal # make-srfi-n # =E2=80=A6) =E2=80=A6) =
=E2=80=A6)
trace: |  |  |  (syntax-module #<syntax:r6rs-libraries.scm:92:34 srfi>)
trace: |  |  |  (hygiene guile)
trace: |  |  |  (source-properties srfi-160)
trace: |  |  |  ()
trace: |  |  (make-syntax srfi-160 ((top) #(ribcage #(n rest version) #((to=
p) (top) (top)) #("l-680b775fb37a463-160b" "l-680b775fb37a463-160c" "l-680b=
775fb37a463-160d")) #(ribcage (# # make-srfi-n # # =E2=80=A6) =E2=80=A6) =
=E2=80=A6) =E2=80=A6)
trace: |  |  #<syntax srfi-160>
trace: |  |  ($sc-dispatch (u8) ())
trace: |  |  |  (syntax? (u8))
trace: |  |  |  #f
trace: |  |  (match* (u8) () (()) () #f)
trace: |  |  #f
trace: |  |  ($sc-dispatch (u8) (any . each-any))
trace: |  |  |  (syntax? (u8))
trace: |  |  |  #f
trace: |  |  (match* (u8) (any . each-any) (()) () #f)
trace: |  |  |  (match () each-any (()) () #f)
trace: |  |  |  |  (syntax? ())
trace: |  |  |  |  #f
trace: |  |  |  (match* () each-any (()) () #f)
trace: |  |  |  |  (match-each-any () (()) #f)
trace: |  |  |  |  ()
trace: |  |  |  (())
trace: |  |  (match u8 any (()) (()) #f)
trace: |  |  |  (source-wrap u8 (()) #f #f)
trace: |  |  |  u8
trace: |  |  (u8 ())
trace: |  |  (_ #<procedure 7fc0c108e1e0 at ice-9/r6rs-libraries.scm:93:7 (=
name rest)> (u8 ()))
trace: |  |  (_ u8 ())
trace: |  |  |  (append () (()))
trace: |  |  |  (())
--8<---------------cut here---------------end--------------->8---

This corresponds to this source:

--8<---------------cut here---------------start------------->8---
 (syntax-case import-spec (library only except prefix rename srfi)
    ;; (srfi :n ...) -> (srfi srfi-n ...)
    ;; (srfi n ...) -> (srfi srfi-n ...)
    ((library (srfi n rest ... (version ...)))
     (srfi-name? #'(srfi n rest ...))
     (let ((srfi-n (make-srfi-n #'srfi #'n)))
       (resolve-r6rs-interface
        (syntax-case #'(rest ...) ()
          (()
           #`(library (srfi #,srfi-n (version ...))))
          ((name rest ...)
           ;; SRFI 97 says that the first identifier after the `n'
           ;; is used for the libraries name, so it must be ignored.
           #`(library (srfi #,srfi-n rest ... (version ...))))))))
    ...
--8<---------------cut here---------------end--------------->8---

Notice the comment mentioning that the first identifier following 'n' is
ignored.  That seems wrong, at least in the context of R7RS libraries.

--=20
Thanks,
Maxim




Information forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Nov 2023 19:45:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 23 14:45:46 2023
Received: from localhost ([127.0.0.1]:35157 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6Fdx-0001GY-Dc
	for submit <at> debbugs.gnu.org; Thu, 23 Nov 2023 14:45:45 -0500
Received: from lists.gnu.org ([2001:470:142::17]:47028)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1r6Fdv-0001GI-PR
 for submit <at> debbugs.gnu.org; Thu, 23 Nov 2023 14:45:44 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1r6Fdi-0000jt-6m
 for bug-guile@HIDDEN; Thu, 23 Nov 2023 14:45:33 -0500
Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1r6Fdg-00060M-2v
 for bug-guile@HIDDEN; Thu, 23 Nov 2023 14:45:29 -0500
Received: by mail-qt1-x833.google.com with SMTP id
 d75a77b69052e-41f155c862bso5764181cf.2
 for <bug-guile@HIDDEN>; Thu, 23 Nov 2023 11:45:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700768725; x=1701373525; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=nv6cbYg0g0yEqjRMcUJiJMwc0SmBh5oC+KNoMxDUzro=;
 b=ijXcdtGxaB9X0qS1VJVJEWnTHEi5tfEDdWDu04mgF9AnbYC34Nprb40hWdSYRNE/kC
 dLvltvoIIHdj7C+vLnpvEXkXr1pfWtSWdwJoB9nzr9jtF0upJ7MDRia18M9ih5X0rdh5
 9wszaD0SabyH2vnYD/W47nio2h2OKSGifK0kTPJxsaaMw59qUd0+TgTp2esEYNE6/601
 6ZgobzXHwJQ2FBpKAmS17XSO8Ap4+ZMNH0wuJey9I55AJIeRXvRaeh1H9oUzptUHSnuT
 y9CBMKFPLNfzyuiUoEVJdhmVxtLsewjSGK3neVkoU+g3mA16LSHKhLkDs2x2As7Z1i5Q
 ke7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700768725; x=1701373525;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=nv6cbYg0g0yEqjRMcUJiJMwc0SmBh5oC+KNoMxDUzro=;
 b=sEVr+PaluwgLjKYCe89sm9t4p+mA/8Wwk8byE/kceDZ7jlx7Ru84adObT88jax/oG0
 nqmJGr9vbsY8GleB/l0P+CzGKoDeZrgzuiDNG/VTvxoOpDeu7uIn9DkD3Nh2WyX/nkm8
 Rbpi8vExlWI8KJdz55WcQ4Q89qn+SARj+aZbg6IH9TYBEec9jYn9VazGCTu573Yu8hER
 qDKP7XzIvDNX1wXpELKOL0puqIQds+0BL/S/qKJ2uduGjsvFQ/sGhUR1sA4WBjiElkud
 epHA7fTuCy0dP7R8QBGA4riSvTIs4mphwSL0jhMOuTaA7xFyxtME0Uo+yDmqjRgPlETj
 /mOA==
X-Gm-Message-State: AOJu0YyrV4+NGaIpIvHIM790v2/iqM4bExZq+S/vkL2B+jF4h1BwpMka
 8D6ikkmAFJXx2v7tzNkiL9cKOnjIljc=
X-Google-Smtp-Source: AGHT+IHfZE+gAfUUW0NYzeZlbqBUOfoP4AJ6/y15v5MaKFG++4i83mzaD2ED4cNhODzDMqwm8C8enw==
X-Received: by 2002:a05:622a:18d:b0:41c:c8f2:58ce with SMTP id
 s13-20020a05622a018d00b0041cc8f258cemr531630qtw.27.1700768725075; 
 Thu, 23 Nov 2023 11:45:25 -0800 (PST)
Received: from hurd (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102])
 by smtp.gmail.com with ESMTPSA id
 b12-20020ac8678c000000b0041b25ebc190sm693971qtp.44.2023.11.23.11.45.24
 for <bug-guile@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Nov 2023 11:45:24 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: bug-guile <bug-guile@HIDDEN>
Subject: (resolve-r6rs-interface '(srfi 160 u8) tries to load (srfi srfi-160)
Date: Thu, 23 Nov 2023 14:45:23 -0500
Message-ID: <87o7fk6yp8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::833;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qt1-x833.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hello,

While working on integrating SRFI 178, I've encountered the following
problem:

--8<---------------cut here---------------start------------->8---
Backtrace:
In system/base/compile.scm:
     53:4 19 (call-once #<procedure 7f77d26e94c0 at system/base/comp?>)
In ice-9/boot-9.scm:
  1755:12 18 (with-exception-handler #<procedure 7f77d65faf00 at ic?> ?)
In system/base/compile.scm:
    69:11 17 (_)
   190:11 16 (_ #<closed: file 7f77d35f78c0>)
    309:6 15 (read-and-compile #<input: srfi/srfi-178.sld 15> #:from ?)
   331:39 14 (with-compiler #<<language> name: scheme title: "Schem?> ?)
   261:27 13 (_ #<syntax:srfi-178.sld:1:0 (#<syntax:srfi-178.sld:1:?> ?)
In ice-9/boot-9.scm:
   2919:4 12 (save-module-excursion #<procedure 7f77d660c200 at lang?>)
In language/scheme/compile-tree-il.scm:
    31:15 11 (_)
In ice-9/psyntax.scm:
  1229:36 10 (expand-top-sequence (#<syntax:srfi-178.sld:1:0 (#<sy?>) ?)
  1121:20  9 (lp (#<syntax:srfi-178.sld:1:0 (#<syntax:srfi-178.sld?>) ?)
  1342:32  8 (syntax-type (#<syntax:r6rs-libraries.scm:291:12 li?> ?) ?)
  1562:32  7 (expand-macro #<procedure 7f77d64d1d30 at ice-9/r6rs-l?> ?)
In ice-9/r6rs-libraries.scm:
   304:14  6 (_ #<syntax:r6rs-libraries.scm:291:21 srfi> (#<syntax?>) ?)
In ice-9/boot-9.scm:
   222:29  5 (map1 (#<syntax:srfi-178.sld:2:10 (#<syntax:srfi-178?> ?))
   222:29  4 (map1 (#<syntax:srfi-178.sld:3:10 (#<syntax:srfi-178?> ?))
   222:29  3 (map1 (#<syntax:srfi-178.sld:4:10 (#<syntax:srfi-178?> ?))
   222:17  2 (map1 (#<syntax:srfi-178.sld:5:10 (#<syntax:srfi-178.s?>))
   3413:6  1 (resolve-interface (srfi srfi-160) #:select _ #:hide _ # ?)
  1676:22  0 (lp 0)

ice-9/boot-9.scm:1676:22: In procedure lp:
no code for module (srfi srfi-160)
--8<---------------cut here---------------end--------------->8---

Indeed, there's no such (srfi 160) module in SRFI 160, but why is it
loaded in the first place?  My srfi-178.sld R7RS library imports:

--8<---------------cut here---------------start------------->8---
(define-library (srfi 178)
  (import (scheme base))
  (import (scheme case-lambda))
  (import (srfi 151))
  (import (srfi 160 u8))
  ...
--8<---------------cut here---------------end--------------->8---

There seems to be something that doesn't work as expected in the (ice-9
r6rs-libraries) module:

--8<---------------cut here---------------start------------->8---
(resolve-r6rs-interface '(srfi 160 u8))
ERROR: no code for module (srfi srfi-160)
--8<---------------cut here---------------end--------------->8---

(srfi 160) should not be loaded; it's (srfi 160 u8) that is requested.

-- 
Thanks,
Maxim




Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#67412; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

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