From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] srfi-64: fix unused variable warnings Date: Thu, 1 Apr 2021 23:13:25 -0700 Message-ID: References: <20210401061135.11914-1-aconchillo@gmail.com> <74a46c307dac2d9e2dbc4affdaa5c56a75fc2b1b.camel@telenet.be> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31848"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Apr 02 08:13:52 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSD43-0008C1-Ta for guile-devel@m.gmane-mx.org; Fri, 02 Apr 2021 08:13:51 +0200 Original-Received: from localhost ([::1]:33308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSD42-0005bD-VQ for guile-devel@m.gmane-mx.org; Fri, 02 Apr 2021 02:13:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSD3s-0005b7-8U for guile-devel@gnu.org; Fri, 02 Apr 2021 02:13:40 -0400 Original-Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:46680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lSD3q-0001Vt-4h for guile-devel@gnu.org; Fri, 02 Apr 2021 02:13:39 -0400 Original-Received: by mail-pg1-x52a.google.com with SMTP id t140so2978586pgb.13 for ; Thu, 01 Apr 2021 23:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3iXDcO8nWAYOFvKb9AQ2BBE6IHtl3+ks4jdpGJSlHls=; b=iUhxd/HsPeeCsXda4jysoK5z0ZJGTYFKoKxxCeZlvo1s4hbQugIDiNZ3RknjdFhJwZ CFIzBIHs1FuQMSJYT/J8ajlQiMB0RyvOzzFVlAezRy/u+se4mZ8w2tU/Zlqx0bNeNpn6 tfubgCs4XbW7uGyOkkhZ7Qw5ujSa3FBoPD7Gvo771Cc+Z2kNV/dIWrECzzvvhIgp2SYE G0ZTjDn5lYO2zYiLsHNkCEQHjmuGv+1MGsZvuJlXwadcC1BjIstR8uzPfko/5BMEAA55 Fc+W4OKqrTqlQ6zJvKlB+Jp0n/eHHIu1yEX+yccZcXwrIJCxjeXcg0CgIlaCGQySICCA ZLZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3iXDcO8nWAYOFvKb9AQ2BBE6IHtl3+ks4jdpGJSlHls=; b=hKKIj+ofdyDGPOjrAdtKakD4VPMreSK6UiRSJi3z9eBGrAEW23jRUQwEzzJGICrC3C hxFX+HPrAhJkyElQ1k/jc9pID6UudkN2CndOirw8qr/3q8tuhTs9ZsZ+jIBwEQ4p64jA mXVPlVtArUkskSuupAMrwgEcPk2l2Kn9EKI2NDWUmQmCM3S3XHbM4hcesHr5W8+fgLsH bPnjj3wYduFGo9BYM8d7dD+4MnthtuMijj0SlkikJjfK54pA8DrqjIzFCxGNysyDDcwh 1A/ghCq9Oo5WpxURUJwQu/h7MnJJ8nl685Vn1F+mC/A5c7dXdluAGQein+vJuTGE+pjo m56g== X-Gm-Message-State: AOAM533rtoCvWUSIHEJ74VDq/aYJOpcSAFUibCM4y6Ig4DduVPjnjAbO cErmqcweyuUMW0j3xxrNYPGsKne1kNBq55zbO+4= X-Google-Smtp-Source: ABdhPJyqgOrePJeJ04PRH8KiI6wwfR/eduanDbiJRhLhEQvzj25P8ozxUeIwvAOaxtf+AdGVDTAQopklmRKycQKp8y8= X-Received: by 2002:a63:d153:: with SMTP id c19mr10514639pgj.311.1617344016395; Thu, 01 Apr 2021 23:13:36 -0700 (PDT) In-Reply-To: <74a46c307dac2d9e2dbc4affdaa5c56a75fc2b1b.camel@telenet.be> Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=aconchillo@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20723 Archived-At: Hi Maxime, Thank you for your comments! On Thu, Apr 1, 2021 at 4:37 AM Maxime Devos 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' macro= s > behave somewhat more like procedure calls (except for installing exeption > handlers and having access to the s-expression of the code that will be r= un, > 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 catc= h > exceptions. How the failure is reported depends on the test runner envir= onment. > The test-name is a string that names the test case. (Though the test-nam= e is > a string literal in the examples, it is an expression. ***It is evaluate= d only once.***) > It is used when reporting errors, and also when skipping tests, as descr= ibed 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 s= eems 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 =E2=80=98merely=E2=80=99 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