unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#65363: Missing support for (library ...) match condition in 'cond-expand'
@ 2023-08-18 11:18 Zhu Zihao
  2023-11-28  3:53 ` Maxim Cournoyer
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Zihao @ 2023-08-18 11:18 UTC (permalink / raw)
  To: 65363

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#65363: Missing support for (library ...) match condition in 'cond-expand'
  2023-08-18 11:18 bug#65363: Missing support for (library ...) match condition in 'cond-expand' Zhu Zihao
@ 2023-11-28  3:53 ` Maxim Cournoyer
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Cournoyer @ 2023-11-28  3:53 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 65363

Hi,

Zhu Zihao <all_but_last@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-28  3:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 11:18 bug#65363: Missing support for (library ...) match condition in 'cond-expand' Zhu Zihao
2023-11-28  3:53 ` Maxim Cournoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).