unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Zhu Zihao <all_but_last@163.com>
Cc: 65363@debbugs.gnu.org
Subject: bug#65363: Missing support for (library ...) match condition in 'cond-expand'
Date: Mon, 27 Nov 2023 22:53:06 -0500	[thread overview]
Message-ID: <87edga5yal.fsf@gmail.com> (raw)
In-Reply-To: <86pm3ky4lk.fsf@163.com> (Zhu Zihao's message of "Fri, 18 Aug 2023 19:18:16 +0800")

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	other threads:[~2023-11-28  3:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edga5yal.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=65363@debbugs.gnu.org \
    --cc=all_but_last@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).