[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 02/16] Use R7RS 'rename' syntax for exports.
From: |
Maxim Cournoyer |
Subject: |
[PATCH v7 02/16] Use R7RS 'rename' syntax for exports. |
Date: |
Mon, 4 Dec 2023 16:45:07 -0500 |
From: Timothy Sample <samplet@ngyro.com>
* module/ice-9/r7rs-libraries.scm (define-library): Convert R7RS
exports to R6RS exports before passing them on to 'library'.
* NEWS: Mention bug fix.
Fixes: https://bugs.gnu.org/67255
Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>.
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
(no changes since v5)
Changes in v5:
- Update NEWS
NEWS | 2 ++
module/ice-9/r7rs-libraries.scm | 10 ++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 6676c5715..6284bb127 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,8 @@ other operations, given the internal use of those functions.
** Fix 'include' not finding included files when byte compiling Guile
(<https://bugs.gnu.org/66046>)
+** R7RS define-library now properly supports 'rename' declarations
+ (<https://bugs.gnu.org/67255>)
Changes in 3.0.9 (since 3.0.8)
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)))))))
--
2.41.0
- [PATCH v7 00/16] Add SRFI 209 and dependencies; improve support for R7RS libraries, Maxim Cournoyer, 2023/12/04
- [PATCH v7 01/16] ice-9: Fix 'include' when used in compilation contexts., Maxim Cournoyer, 2023/12/04
- [PATCH v7 02/16] Use R7RS 'rename' syntax for exports.,
Maxim Cournoyer <=
- [PATCH v7 03/16] r7rs-libraries: Add support for 'else' clause in cond-expand., Maxim Cournoyer, 2023/12/04
- [PATCH v7 05/16] (scheme base): Support non-negative SRFI integer names in cond-expand., Maxim Cournoyer, 2023/12/04
- [PATCH v7 07/16] build: Register '.sld' as an alternative extension to '.scm'., Maxim Cournoyer, 2023/12/04
- [PATCH v7 06/16] Share features tested by cond-expand library declarations and expressions., Maxim Cournoyer, 2023/12/04
- [PATCH v7 09/16] module: Add SRFI 128., Maxim Cournoyer, 2023/12/04
- [PATCH v7 12/16] module: Add SRFI 125., Maxim Cournoyer, 2023/12/04
- [PATCH v7 16/16] module: Add SRFI 209., Maxim Cournoyer, 2023/12/04
- [PATCH v7 10/16] module: Add (scheme comparator)., Maxim Cournoyer, 2023/12/04
- [PATCH v7 08/16] module: Add SRFI 126., Maxim Cournoyer, 2023/12/04
- [PATCH v7 15/16] module: Add SRFI 178., Maxim Cournoyer, 2023/12/04