From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] srfi-64: fix unused variable warnings
Date: Thu, 1 Apr 2021 23:13:25 -0700 [thread overview]
Message-ID: <CA+XASoW7=1=SUaRD+6mEq+_SD_LYAZMa+LgGQmV96zQA2uQozw@mail.gmail.com> (raw)
In-Reply-To: <74a46c307dac2d9e2dbc4affdaa5c56a75fc2b1b.camel@telenet.be>
Hi Maxime,
Thank you for your comments!
On Thu, Apr 1, 2021 at 4:37 AM Maxime Devos <maximedevos@telenet.be> wrote:
> For example, in:
>
> > (define (%test-comp2 comp x)
> > (syntax-case (list x (list (syntax quote) (%test-source-line2 x)) comp) ()
> > (((mac tname expected expr) line comp)
> > (syntax
> > - (let* ((r (test-runner-get))
> > - (name tname))
> > + (let ((r (test-runner-get)))
> > (test-result-alist! r (cons (cons 'test-name tname) line))
> > (%test-comp2body r comp expected expr))))
>
> I would keep the let* (but reverse the binding order), but change 'tname'
> with 'name' in the call to 'test-result-alist!', such that 'test-X' macros
> behave somewhat more like procedure calls (except for installing exeption
> handlers and having access to the s-expression of the code that will be run,
> of course). It's largely a matter of taste, though.
>
I've done this change. One thing I don't understand is the "reverse
the binding order", I've done it as suggested but is this change the
one you refer to as "matter of taste"?
> In any case, it is good that 'tname' is now evaluated only once, as per
> SRFI-64 (notice ***It is evaluated only once.*** (markup mine)):
>
> (test-assert [test-name] expression)
>
> This evaluates the expression. The test passes if the result is true;
> if the result is false, a test failure is reported. The test also fails
> if an exception is raised, assuming the implementation has a way to catch
> exceptions. How the failure is reported depends on the test runner environment.
> The test-name is a string that names the test case. (Though the test-name is
> a string literal in the examples, it is an expression. ***It is evaluated only once.***)
> It is used when reporting errors, and also when skipping tests, as described below.
> It is an error to invoke test-assert if there is no current test runner.
>
> (My suggestion would be to also evaluate 'test-name' at least once, even if there
> is no test runner, which seems a bit stricter than SRFI-64 demands, but seems like
> a nice property to have and easy to achieve.)
>
Yes, this makes sense. Thanks again for pointing that out.
> As this patch does not ‘merely’ fix a warnings, but fixes a bug, could you change
> the patch message accordingly? Something like
>
> srfi-64: fix double evaluation of test-name.
>
> perhaps?
>
Sounds good to me.
Best,
Aleix
next prev parent reply other threads:[~2021-04-02 6:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 6:11 [PATCH] srfi-64: fix unused variable warnings Aleix Conchillo Flaqué
2021-04-01 11:37 ` Maxime Devos
2021-04-02 6:13 ` Aleix Conchillo Flaqué [this message]
[not found] ` <CA+XASoWMDakd2rAu96iZB-=giHLoer1gcM4dgu+wxg1MCZ9xDw@mail.gmail.com>
2021-04-02 6:58 ` Maxime Devos
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='CA+XASoW7=1=SUaRD+6mEq+_SD_LYAZMa+LgGQmV96zQA2uQozw@mail.gmail.com' \
--to=aconchillo@gmail.com \
--cc=guile-devel@gnu.org \
--cc=maximedevos@telenet.be \
/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).