[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 03/07: Allow (library ...) form in cond-expand inside R7
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 03/07: Allow (library ...) form in cond-expand inside R7RS define-library. |
Date: |
Thu, 16 Jun 2022 04:06:51 -0400 (EDT) |
civodul pushed a commit to branch main
in repository guile.
commit 158da6966b9ea2e949ae714863861d4f5bc5a56e
Author: Mihail Iosilevich <yosik@paranoid.email>
AuthorDate: Sun Jun 12 13:13:32 2022 +0300
Allow (library ...) form in cond-expand inside R7RS define-library.
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.
* module/ice-9/r7rs-libraries.scm (define-library): Replace
'resolve-interface' call by 'resolve-r6rs-interface', wrapped in
'cond-expand'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
module/ice-9/r7rs-libraries.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
- [Guile-commits] branch main updated (cc4559768 -> 7e048c6c5), Ludovic Courtès, 2022/06/16
- [Guile-commits] 01/07: 'connect' handles EAGAIN like EINPROGRESS., Ludovic Courtès, 2022/06/16
- [Guile-commits] 02/07: 'module-define!' honors the 'module' parameter., Ludovic Courtès, 2022/06/16
- [Guile-commits] 05/07: Allow null bytes in UNIX sockets., Ludovic Courtès, 2022/06/16
- [Guile-commits] 06/07: Add missing #:modules argument for coverage-data->lcov., Ludovic Courtès, 2022/06/16
- [Guile-commits] 07/07: Update NEWS., Ludovic Courtès, 2022/06/16
- [Guile-commits] 03/07: Allow (library ...) form in cond-expand inside R7RS define-library.,
Ludovic Courtès <=
- [Guile-commits] 04/07: Allow empty vendor string in GNU target triplets., Ludovic Courtès, 2022/06/16