bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65363: Missing support for (library ...) match condition in 'cond-ex


From: Maxim Cournoyer
Subject: bug#65363: Missing support for (library ...) match condition in 'cond-expand'
Date: Mon, 27 Nov 2023 22:53:06 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]