[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: possibly unused local top-level variable `%foo?-procedure'
From: |
Linus Björnstam |
Subject: |
Re: warning: possibly unused local top-level variable `%foo?-procedure' |
Date: |
Thu, 06 Jun 2024 22:02:50 +0200 |
User-agent: |
Cyrus-JMAP/3.11.0-alpha0-497-g97f96844c-fm-20240526.001-g97f96844 |
Which version are you using? All my similar issues with srfi-9 went away last
year when srfi things were marked maybe-unused.
I don't have a computer this week so I cannot try your code. Sorry.
--
Linus Björnstam
On Wed, 5 Jun 2024, at 17:02, Tomas Volf wrote:
> Hello,
>
> I am getting following warning from a guild compile:
>
> warning: possibly unused local top-level variable `%foo?-procedure'
>
> And I am not sure how to tackle it. This is my full source code:
>
> (define-module (x)
> #:use-module (srfi srfi-9)
> #:export (<foo>
> foo?
> make-foo))
>
> (define-record-type <foo> (make-foo) foo?)
>
> When I try to compile it:
>
> $ guild compile -W 3 -o x.go x.scm
> x.scm:7:0: warning: possibly unused local top-level variable
> `%foo?-procedure'
> wrote `x.go'
>
> I would (for obvious reasons) like to keep my compilation warning-free. I can
> think of two approaches:
>
> 1. Export the %foo?-procedure
> I think this would confuse downstream users, since they are not expected
> to
> use it directly.
>
> 2. Mark the procedure as used
> In C I could use `(void)proc;', is there an equivalent of that construct
> in Guile?
>
> Are there other options? How are you approaching it?
>
> Thank you and have a nice day,
> Tomas Volf
>
> PS: I am not even sure why this warning happens, the `foo?' syntax transformer
> is exported and *does* reference it (as far as I can tell from ,expand).
>
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.
>
> Attachments:
> * signature.asc