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 v8 05/16] (scheme base): Support non-negative SRFI integer names in cond-expand. Date: Wed, 6 Dec 2023 18:15:01 -0500 Message-ID: <20231206231512.6505-6-maxim.cournoyer@gmail.com> References: <20231206231512.6505-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="37139"; 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 Thu Dec 07 00:16:52 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 1rB18N-0009Pc-9A for guile-devel@m.gmane-mx.org; Thu, 07 Dec 2023 00:16:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rB17b-00020P-OI; Wed, 06 Dec 2023 18:16:03 -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 1rB17H-0001nt-6q for guile-devel@gnu.org; Wed, 06 Dec 2023 18:15:45 -0500 Original-Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rB174-00017o-B6 for guile-devel@gnu.org; Wed, 06 Dec 2023 18:15:42 -0500 Original-Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-67a89dc1ef1so1976106d6.3 for ; Wed, 06 Dec 2023 15:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701904528; x=1702509328; 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=P3jqh6I+pJFA/xiJdF29eAmzvBm1Zw9Yr7wnSZEicSI=; b=N8Klmq6btIvhTxoyvcJGQEU++kRNFgzgTx9xqoKyvAGjpnFSgF6DphJje7oaAmYaFi s6/cnBaVsa3eo+9iPQWUWBHwNPWwyF7oznOIQm2S+McKOAWiZwyW2y45myp6JrdCRhZm iLDDKMm6Ni9rClFqf/ZYLaFnk2pOD0bI/w2pcPyk2VqAAcl11sHiNOAlDklMWyDmuEnX ON5EWPRMRpzcX3XMzrc0WUyRmpQkZ4OGFn1MhfVhEbKir5vBk5uS1ihcMvc0rryMfJ8k DcVwNhaO/ko6IVhjaxaiDgGtUvItVU57xVamYYHtnLTdkAyr9rNZ28PafhHMt2XRvvFk Anow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701904528; x=1702509328; 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=P3jqh6I+pJFA/xiJdF29eAmzvBm1Zw9Yr7wnSZEicSI=; b=a1+KqzGzcy+6UC60hsgn2iIdRZqxAgPLj3YgqBd5G8aaHpM9ojifz3bi03HQGZwtHe GnEHimdX5Nv65xJSDrBPQltuosnFGV58lW04XM256HjMFZ4MBM5xYZzwPFZW4NsVrwKM Skad22JHyG1eC/p1zisxSRFEzn82yHgH94G3qtonrmgBFkk5GWLXzIvzrrMOuzRL59uV 8+1h5STH22mu9mnEKvs8lb+XbDFo0jSDbUYOf51OB6ZufbjiIcZ2PNU/m6+HuLCZX87H eiVwwmiekGbRy26XuE352rf5d253in7FXN0hi5Z6zwrqNv3fCS42sfCV6MSt3NDf/XhM PxkQ== X-Gm-Message-State: AOJu0YwQCFcDLtYRElLWO9hgrQIFca+PSu5OwGwJzPQItIyQDhnM0crL gz7wYwG3MffD3JOBq2vSoPpIqWcoH1k= X-Google-Smtp-Source: AGHT+IGWHMDZ6ejfhaCZG1sW5kA/i5WNmvyIR9FBB7NWbRG5uXCKGzvgd20EX3fJWpFZAPi+eerbOw== X-Received: by 2002:ad4:5382:0:b0:67a:bb33:c538 with SMTP id i2-20020ad45382000000b0067abb33c538mr2077528qvv.131.1701904527988; Wed, 06 Dec 2023 15:15:27 -0800 (PST) Original-Received: from localhost.localdomain (dsl-10-130-68.b2b2c.ca. [72.10.130.68]) by smtp.gmail.com with ESMTPSA id re18-20020a05620a8e1200b0077d8ad77069sm3400qkn.26.2023.12.06.15.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 15:15:27 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231206231512.6505-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf34.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, 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:22207 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. --- (no changes since v5) 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