GNU bug report logs - #65363
Missing support for (library ...) match condition in 'cond-expand'

Previous Next

Package: guile;

Reported by: Zhu Zihao <all_but_last <at> 163.com>

Date: Fri, 18 Aug 2023 11:27:02 UTC

Severity: normal

Tags: moreinfo

To reply to this bug, email your comments to 65363 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#65363; Package guile. (Fri, 18 Aug 2023 11:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zhu Zihao <all_but_last <at> 163.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 18 Aug 2023 11:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zhu Zihao <all_but_last <at> 163.com>
To: bug-guile <at> gnu.org
Subject: Missing support for (library ...) match condition in 'cond-expand' 
Date: Fri, 18 Aug 2023 19:18:16 +0800
[Message part 1 (text/plain, inline)]
In R7RS, page 14, section 4.2.1 Conditionals. The form 'cond-expand' can
accept following conditions

```
A <feature requirement> takes one of the following forms:

- <feature identifier>
- (library <library name>)
- (and <feature requirement> ...)
- (or <feature requirement> ...)
- (not <feature requirement>)
```

The form (library <library name>) is used to test whether a R7RS library
named <library name> exists or not. For example:

```
(cond-expand
 ((library (srfi srfi-1))
  (display "Yes, we have SRFI-1.\n")))
```

However, this form is currently not supported by Guile. Supporting this
form can help Guile use portable R7RS library more smoothly.

-- Retrieve my PGP public key:

  gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC

Zihao
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#65363; Package guile. (Tue, 28 Nov 2023 03:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 65363 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Zhu Zihao <all_but_last <at> 163.com>
Cc: 65363 <at> debbugs.gnu.org
Subject: Re: bug#65363: Missing support for (library ...) match condition in
 'cond-expand' 
Date: Mon, 27 Nov 2023 22:53:06 -0500
Hi,

Zhu Zihao <all_but_last <at> 163.com> writes:

> In R7RS, page 14, section 4.2.1 Conditionals. The form 'cond-expand' can
> accept following conditions
>
> ```
> A <feature requirement> takes one of the following forms:
>
> - <feature identifier>
> - (library <library name>)
> - (and <feature requirement> ...)
> - (or <feature requirement> ...)
> - (not <feature requirement>)
> ```
>
> The form (library <library name>) is used to test whether a R7RS library
> named <library name> exists or not. For example:
>
> ```
> (cond-expand
>  ((library (srfi srfi-1))
>   (display "Yes, we have SRFI-1.\n")))
> ```
>
> However, this form is currently not supported by Guile. Supporting this
> form can help Guile use portable R7RS library more smoothly.

I'm not sure what doesn't work with the above example; it should work
when used within a define-library, per this 2020 commit:

--8<---------------cut here---------------start------------->8---
commit fd2ffc649c2d08639c2ac41c25e4ebdbeb4b151d
Date:   Sun Jan 12 20:14:30 2020 +0100

    Support R7RS define-library
--8<---------------cut here---------------end--------------->8---

I've found it had a few omissions, which I've corrected locally, such as
not handling 'else' clauses or (srfi N) names, but your example should
have worked, AFAIK.

If trying 'cond-expand' from the REPL, you'll want to ,use (scheme base)
to get the newer cond-expand definition shadow the SRFI 0 one that is
defined in (guile).

-- 
Thanks,
Maxim




Added tag(s) moreinfo. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 28 Nov 2023 03:54:02 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.