From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.devel Subject: [PATCH v5 05/15] (scheme base): Support non-negative SRFI integer names in cond-expand. Date: Wed, 29 Nov 2023 16:59:33 -0500 Message-ID: <20231129220225.6819-6-maxim.cournoyer@gmail.com> References: <20231129220225.6819-1-maxim.cournoyer@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12467"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Maxim Cournoyer To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Nov 29 23:04:05 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r8Sf7-00030M-BR for guile-devel@m.gmane-mx.org; Wed, 29 Nov 2023 23:04:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8Sdz-0001AJ-5S; Wed, 29 Nov 2023 17:02:56 -0500 Original-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 ) id 1r8Sdv-00019G-49 for guile-devel@gnu.org; Wed, 29 Nov 2023 17:02:51 -0500 Original-Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8Sds-0004Ck-Jp for guile-devel@gnu.org; Wed, 29 Nov 2023 17:02:50 -0500 Original-Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-67a2c4e61abso1332226d6.3 for ; Wed, 29 Nov 2023 14:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701295367; x=1701900167; darn=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=e4GtqP/gNwKZFQBqKIKAOY/q55R/hkwp+bH9gCjOrm0=; b=Km1VKQa4Rwe2t5wInLt0KePG5mm3362A+t6RG2xUK/wF8OJcj4pxGDgwnJ2EuE1yf7 kCLI03cW3AEym/TRV7cXz8PYYbtGYOlM7XnrIoIuBN/ELZLrayiTcnbutFqPqU2So5jo oPxUwtxrJLW4gOtQwZb0UQd32+zOhIoRTbY2oEBEeH5hokRZaKFQe1r4Y/px0OX3YcoH Vd7dtzXrXWNqtFFbFKtP3ff9UyGcNTEZtPMhUmeQlJ8t88FD6uwsWSbzod8ZZVawpyYN O351uLpDOq+hq+PYChgJiANMjPsxPCgQ5U6v99qVQerTB0LiQjXbjAtg/eVZXTPPgkVD RRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701295367; x=1701900167; 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=e4GtqP/gNwKZFQBqKIKAOY/q55R/hkwp+bH9gCjOrm0=; b=sqoXXaYW5CZvna2lAcIHN+xW4wLR784+zXCHysVMd49/0gcRjaJyjK2ownUcGLAZtO 6T5hdZ/0tEQKlIPMRAhWhwyUtJtHBWRXJf17PEUIn6gDz5jptIFKDdh9vx9BBTWplQMB abtF3bqWmoMHqBE6Vy7IZ2718kCw0QyNhKkz7QwJIKGrSJi5eU6qDQT1fcz+kKndek43 0VjuIUAl+W5oZEM0IbpHHrxQWvNPckWs+2Gf8yzRUajPvP6XIKdrVrOyl3KeqF4PDYXN C87AHDeavc0P6fNKJeNaV6KwdlbQTtlcRaV8uE6RVNcrSX5jxqf5LzhlmV+53bTHMIu+ qv5g== X-Gm-Message-State: AOJu0YwQPfa7iwYxCDYWdRBjeZVQ1zdukb9/IeSjLGm98oVa43xUZkAG cKPEVlLs3AtMW+PJ9oeG8W3jSoPp/Q4= X-Google-Smtp-Source: AGHT+IFXx9zHrPo8Du/rBWWv30zn5DdmJcv/OiygXyVdMQlH5H2cRTH9KpP7m1X1pzD5hpwG4gLbkA== X-Received: by 2002:a0c:ef87:0:b0:67a:48f2:feb9 with SMTP id w7-20020a0cef87000000b0067a48f2feb9mr11704433qvr.3.1701295367009; Wed, 29 Nov 2023 14:02:47 -0800 (PST) Original-Received: from localhost.localdomain (dsl-158-174.b2b2c.ca. [66.158.158.174]) by smtp.gmail.com with ESMTPSA id g15-20020ad4510f000000b0067a2a0b44ddsm4644444qvp.44.2023.11.29.14.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:02:46 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231129220225.6819-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::f30; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf30.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-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22149 Archived-At: * module/scheme/base.scm (r7:cond-expand): Test for library using resolve-r6rs-interface instead of resolve-interface. Swallow any exception with false-if-exception. * test-suite/tests/r7rs-cond-expand.test: New test. * NEWS: Update news. --- Changes in v5: - Update NEWS NEWS | 1 + module/scheme/base.scm | 5 +++- test-suite/tests/r7rs-cond-expand.test | 35 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 test-suite/tests/r7rs-cond-expand.test diff --git a/NEWS b/NEWS index af66c80bd..1de1fa8b4 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ other operations, given the internal use of those functions. () ** R7RS define-library now properly supports 'rename' declarations () +** (scheme base)'s cond-expand supports non-negative integer in modules names Changes in 3.0.9 (since 3.0.8) diff --git a/module/scheme/base.scm b/module/scheme/base.scm index 477dd9c28..2bd1f0d89 100644 --- a/module/scheme/base.scm +++ b/module/scheme/base.scm @@ -283,7 +283,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) (memq (syntax->datum #'id) (features))))) diff --git a/test-suite/tests/r7rs-cond-expand.test b/test-suite/tests/r7rs-cond-expand.test new file mode 100644 index 000000000..ea880d8c2 --- /dev/null +++ b/test-suite/tests/r7rs-cond-expand.test @@ -0,0 +1,35 @@ +;;; R7RS cond-expand -*- scheme -*- +;;; Copyright (C) 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 License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this program. If not, see +;;; . + +(define-module (test-suite r7rs-cond-expand) + #:use-module ((scheme base) #:select (cond-expand)) + #:use-module ((srfi srfi-64) #:select (test-read-eval-string)) + #:use-module (test-suite lib)) + +(pass-if "cond-expand expression missing library test" + (test-read-eval-string "\ +(cond-expand + ((library (srfi 99999 something)) + #f) + (else #t))")) + +(pass-if "cond-expand expression found library test" + (test-read-eval-string "\ +(cond-expand + ((library (srfi 64)) + #t) + (else #f))")) -- 2.41.0