From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library Resent-From: Mihail Iosilevich Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 12 Jun 2022 20:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55934 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 55934@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165506541917709 (code B ref -1); Sun, 12 Jun 2022 20:24:03 +0000 Received: (at submit) by debbugs.gnu.org; 12 Jun 2022 20:23:39 +0000 Received: from localhost ([127.0.0.1]:56555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0U7J-0004bL-PF for submit@debbugs.gnu.org; Sun, 12 Jun 2022 16:23:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:35070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0KbG-0000tT-PS for submit@debbugs.gnu.org; Sun, 12 Jun 2022 06:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0KbG-0000mF-7w for bug-guile@gnu.org; Sun, 12 Jun 2022 06:13:42 -0400 Received: from smtp.paranoid.email ([149.154.152.236]:16232 helo=mx.paranoid.email) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0KbD-0007Sb-Ro for bug-guile@gnu.org; Sun, 12 Jun 2022 06:13:41 -0400 Received: from [172.19.0.4] (paranoid-filter.vpn [192.168.150.118]) by mx.paranoid.email (Postfix) with ESMTP id 4931A3F76E for ; Sun, 12 Jun 2022 10:13:34 +0000 (UCT) Received: from [127.0.0.1] (95-37-215-100.dynamic.mts-nn.ru [95.37.215.100]) by mx.paranoid.email (Postfix) with ESMTPSA id BF0383F76C for ; Sun, 12 Jun 2022 10:13:33 +0000 (UCT) From: Mihail Iosilevich Date: Sun, 12 Jun 2022 13:13:32 +0300 Message-ID: <87wndmi3zn.fsf@cerbo.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=149.154.152.236; envelope-from=yosik@paranoid.email; helo=mx.paranoid.email X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.4 (-) X-Mailman-Approved-At: Sun, 12 Jun 2022 16:23:23 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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 From unknown Mon Jun 23 20:18:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mihail Iosilevich Subject: bug#55934: closed (Re: bug#55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library) Message-ID: References: <87czf9oy7y.fsf@gnu.org> <87wndmi3zn.fsf@cerbo.mail-host-address-is-not-set> X-Gnu-PR-Message: they-closed 55934 X-Gnu-PR-Package: guile X-Gnu-PR-Keywords: patch Reply-To: 55934@debbugs.gnu.org Date: Thu, 16 Jun 2022 07:38:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1655365082-5682-1" This is a multi-part message in MIME format... ------------=_1655365082-5682-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 55934@debbugs.gnu.org. --=20 55934: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D55934 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1655365082-5682-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 55934-done) by debbugs.gnu.org; 16 Jun 2022 07:37:50 +0000 Received: from localhost ([127.0.0.1]:40586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1k4c-0001TB-0b for submit@debbugs.gnu.org; Thu, 16 Jun 2022 03:37:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1k4Y-0001Sx-P3 for 55934-done@debbugs.gnu.org; Thu, 16 Jun 2022 03:37:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1k4S-0006wi-Q7; Thu, 16 Jun 2022 03:37:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=UgRXOyioKWqJB7Ocwxbf14Wl9FVJkLp6mOXQbWEkd2Q=; b=hTlnfYHcZFuz3iHHsuFI zlbFQEEco23ozHivvebxkL7b/sUcIlz0vsNL5wiKlSdquMDBSNQhiiXxrjmL44hXlsVxCshhEQdBF uMaLF5BBd60GqEonAPGwC9cbvm8ZhdUkFvGQyI7ilUElS7QeznaJ/HE5EKJd8BfzgwpFMIQbU3zqu SUxIdiazx50M90NREwuBtYwO+FKAzaQAi86dn9WvRcb8jeDuWGSzp/3i5UZrEf6K+dNHaeHdmfXj1 /iVLAnDesp6e/Ew+PkuDKZXarCIPMuMUMdWMN3+ahVL2nlUbMIg3anIHFMIcc3AYnRXIXySZJyxfb HK9YpOWRoGQ/vQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52553 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1k4R-0005Da-Rn; Thu, 16 Jun 2022 03:37:40 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mihail Iosilevich Subject: Re: bug#55934: [PATCH] (library ...) form in cond-expand inside R7RS define-library References: <87wndmi3zn.fsf@cerbo.mail-host-address-is-not-set> Date: Thu, 16 Jun 2022 09:37:37 +0200 In-Reply-To: <87wndmi3zn.fsf@cerbo.mail-host-address-is-not-set> (Mihail Iosilevich's message of "Sun, 12 Jun 2022 13:13:32 +0300") Message-ID: <87czf9oy7y.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55934-done Cc: 55934-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Mihail Iosilevich 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=E2=80=99. ------------=_1655365082-5682-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Jun 2022 20:23:39 +0000 Received: from localhost ([127.0.0.1]:56555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0U7J-0004bL-PF for submit@debbugs.gnu.org; Sun, 12 Jun 2022 16:23:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:35070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0KbG-0000tT-PS for submit@debbugs.gnu.org; Sun, 12 Jun 2022 06:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0KbG-0000mF-7w for bug-guile@gnu.org; Sun, 12 Jun 2022 06:13:42 -0400 Received: from smtp.paranoid.email ([149.154.152.236]:16232 helo=mx.paranoid.email) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0KbD-0007Sb-Ro for bug-guile@gnu.org; Sun, 12 Jun 2022 06:13:41 -0400 Received: from [172.19.0.4] (paranoid-filter.vpn [192.168.150.118]) by mx.paranoid.email (Postfix) with ESMTP id 4931A3F76E for ; Sun, 12 Jun 2022 10:13:34 +0000 (UCT) Received: from [127.0.0.1] (95-37-215-100.dynamic.mts-nn.ru [95.37.215.100]) by mx.paranoid.email (Postfix) with ESMTPSA id BF0383F76C for ; Sun, 12 Jun 2022 10:13:33 +0000 (UCT) From: Mihail Iosilevich To: bug-guile@gnu.org Subject: [PATCH] (library ...) form in cond-expand inside R7RS define-library Date: Sun, 12 Jun 2022 13:13:32 +0300 Message-ID: <87wndmi3zn.fsf@cerbo.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=149.154.152.236; envelope-from=yosik@paranoid.email; helo=mx.paranoid.email X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 12 Jun 2022 16:23:23 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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 ------------=_1655365082-5682-1--