From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Timothy Sample Newsgroups: gmane.lisp.guile.bugs Subject: bug#67255: define-library does not support 'rename' directives Date: Mon, 20 Nov 2023 11:14:20 -0600 Message-ID: <87cyw42vpv.fsf@ngyro.com> References: <87r0knbome.fsf@gmail.com> <87a5r84e1l.fsf@ngyro.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23235"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67255@debbugs.gnu.org To: Maxim Cournoyer Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Nov 20 18:15:31 2023 Return-path: Envelope-to: guile-bugs@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 1r57rt-0005lw-EL for guile-bugs@m.gmane-mx.org; Mon, 20 Nov 2023 18:15:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r57rW-0005gz-8y; Mon, 20 Nov 2023 12:15:06 -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 1r57rR-0005gN-3v for bug-guile@gnu.org; Mon, 20 Nov 2023 12:15:01 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r57rQ-0003pX-CB for bug-guile@gnu.org; Mon, 20 Nov 2023 12:15:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r57rS-0008UO-8G for bug-guile@gnu.org; Mon, 20 Nov 2023 12:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Timothy Sample Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 20 Nov 2023 17:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67255 X-GNU-PR-Package: guile Original-Received: via spool by 67255-submit@debbugs.gnu.org id=B67255.170050047532574 (code B ref 67255); Mon, 20 Nov 2023 17:15:02 +0000 Original-Received: (at 67255) by debbugs.gnu.org; 20 Nov 2023 17:14:35 +0000 Original-Received: from localhost ([127.0.0.1]:54356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r57r1-0008TK-Av for submit@debbugs.gnu.org; Mon, 20 Nov 2023 12:14:35 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r57qw-0008Sx-T7 for 67255@debbugs.gnu.org; Mon, 20 Nov 2023 12:14:34 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 714DD5C0C2E; Mon, 20 Nov 2023 12:14:22 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 20 Nov 2023 12:14:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ngyro.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1700500462; x=1700586862; bh=c0 KoduvwaCIm9dTGPQAe8S7z/TL9FxjZp95qOvyiLRQ=; b=D/xKDD2BA7ehsVhBHX UqKX0OxUrVe0BBrF1vVwa+N2d3L8KD7EiSFf8D41x8ifuszNY87YCQHEpj0grXxC 2gOjcTTMt06nqRIQcuYtHvNcARnzUkBHbse8zYxBO/MGGfcQZcRrOP9q6oaPpFnn DXnYqHC5WUrWaVI54ryBZOlbgIFlTOsC4M69f/586uCT7qAHRdZjpFdMFlQDSBuG HI4KKnn+ySVqD8OJxVIlmxxSpdNW7OYHWljODmzz4Y9qkjyqHXEjx8AeEs8c3cki A0KHmJ/5yy8PiXmFgSY3qfcoc5dHKTv69VogXBgFtZYhYUrrifULFeD26Vz3rvlj tqaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1700500462; x=1700586862; bh=c0KoduvwaCIm9 dTGPQAe8S7z/TL9FxjZp95qOvyiLRQ=; b=0NVbGKMZsAZzSPnXAtrUsEH80kge7 7tpW4HwCINsfySSms/rUSz2T5I+Ywf4dJIxpURncSQ8d0MyawFqr5uuNlkSU6TBp 5FPQ9GvS9lX+8Ojwhcw6jCXHhItYFg+hDqCJVCzZPOEs+RHIuCHay4cP1MZr5IBs u5EY9qMinRqNyaNu2olDLaZtdim2fuGo6fUHvPZrxI7o9trA7VGhfnytDUFWO//0 omH4uE7bu0gt0kf9UIMKx2lHxR+MjGBMfH07F0+38eQGmlErnca1KNOlbJjOIJi5 X0rFetBu90RbYrtgZwkVEsKiWklMS+1F9gca4Zmlj0Ll6LMet0tVgjvvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegjedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesmhdtreertderjeenucfhrhhomhepvfhimhho thhhhicuufgrmhhplhgvuceoshgrmhhplhgvthesnhhghihrohdrtghomheqnecuggftrf grthhtvghrnhepteevvddtveefgefgteelueehheffgeeuhfdvgfeuhfehhedthedvueeu udehfedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhplhgvthesnhhghihrohdrtghomh X-ME-Proxy: Feedback-ID: i4721425c:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Nov 2023 12:14:21 -0500 (EST) In-Reply-To: <87a5r84e1l.fsf@ngyro.com> (Timothy Sample's message of "Mon, 20 Nov 2023 09:53:10 -0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10704 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Timothy Sample writes: > Maxim Cournoyer writes: > >> Our R7RS define-library syntax, from (ice-9 r7rs-library) does not >> support renaming bindings to export, via 'rename' directives. > > I appreciate your R7RS debugging effort. Thanks! Actions speak louder than words, so here=E2=80=99s a patch! The =E2=80=98define-library=E2=80=99 syntax uses the R6RS =E2=80=98library= =E2=80=99 syntax under the hood. TIL that R6RS and R7RS have different syntax for 'rename'. In R6RS, you write: (export (rename (internal external))) while in R7RS, it=E2=80=99s: (export (rename internal external)) My patch adds a conversion step to deal with this difference. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-R7RS-rename-syntax-for-exports.patch >From b87bf8910ac8e75dc0ec63cb7385ddf199fd400c Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Mon, 20 Nov 2023 11:01:08 -0600 Subject: [PATCH] Use R7RS 'rename' syntax for exports. Fixes . Reported by Maxim Cournoyer . * module/ice-9/r7rs-libraries.scm (define-library): Convert R7RS exports to R6RS exports before passing them on to 'library'. --- 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))))))) -- 2.41.0 --=-=-=--