From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.help
Subject: Re: How to avoid compiler warning `unused lexical variable' for
`dolist' or `dotimes'?
Date: Thu, 7 Jan 2021 12:33:49 +0100
Message-ID:
References:
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="1878"; mail-complaints-to="usenet@ciao.gmane.io"
To: Help GNU Emacs
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 07 12:34:23 2021
Return-path:
Envelope-to: geh-help-gnu-emacs@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 1kxTYd-0000GO-PK
for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 07 Jan 2021 12:34:23 +0100
Original-Received: from localhost ([::1]:44800 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1kxTYc-0008Rj-SI
for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 07 Jan 2021 06:34:22 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59512)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1kxTYJ-0008RZ-VP
for help-gnu-emacs@gnu.org; Thu, 07 Jan 2021 06:34:03 -0500
Original-Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]:37131)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1kxTYH-0006SI-NY
for help-gnu-emacs@gnu.org; Thu, 07 Jan 2021 06:34:03 -0500
Original-Received: by mail-oo1-xc36.google.com with SMTP id p72so1491746oop.4
for ; Thu, 07 Jan 2021 03:34:01 -0800 (PST)
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
:content-transfer-encoding;
bh=P5Sk/7LOInIDVTKcgW8Oij4NRakz84uPJ0SVnycf6BI=;
b=U53jem8DZNv6LhJFFRuSfxxtu5a+Qvrbd6oEvoOX7ILPoxj56zt/Lcy7muIzSgV8jI
qCY5oL0XOiHuntNrGWZN0taLQMublO1XRVY6FWJROa4D8WXLr5IIXNBJWTT7ITuJVq9A
b9NkKjQY0E75HZbsQXjlkGBLe6nKiPG5eg6ZlbgLCsLGFdnXg/Q0lawnz2O5dsNy+MUd
tq7OtcIOcAZwdDGbEgaFkFYFn+o2MPvuVjCldNN/nckL7uoJaZZ06v4uV9fG9IhefJvj
+UQqQs2B2vDRXi03L9+c2PERo9J1ehat0Peri7D99gXdxOyGT3ypCStM9vLdBxiLJece
gGfQ==
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:content-transfer-encoding;
bh=P5Sk/7LOInIDVTKcgW8Oij4NRakz84uPJ0SVnycf6BI=;
b=n501n1djmM9Ua3jVQgUtwcpjP5/2Upk4/0UtHvaBd1zMJYYqVTY7UuehKS+eRUbMMC
3IwsF+r0DEiiLSs6zZ6BJ5THNtUPH83u01TEZc6G0nAySBsPDOK1rwbVXudan2L5ck7z
no1hbsjwR+6Cad/l1aOTEG77KR54av+DrvjbBk3foVDo5Pk7aoeFMrRGAE7YoHRC2hF4
KwTRXgABSD0xZi9CcxM4zkjP8Tbe0i/jH58/U5a+j8aGXQtr/PUY/rMxVmWBlJPJ5pfF
EV1m/biCn8jLB5rhY141ZW6xsly6XG7b9uQxJEjkRG8btI5NG96S/nvHjZIuEO6QfEvP
3l7Q==
X-Gm-Message-State: AOAM532Z5t2Z3ikoxQiu0tYZ21ISEVUI+pth5TSqd0vCVM6Mf0d45Y9h
r2YxEv94HXqeEPckHErPUD0Etgf2j+jxcD73BiaqrXH/P2c=
X-Google-Smtp-Source: ABdhPJyxUes3+W14xjHPNjJ6oabj136biEkDWrg52h5r0YNCrqzwXiRfv/QrzqO96apTe7CgUVLAq9ryxh7DMJe3bMI=
X-Received: by 2002:a4a:e8d1:: with SMTP id h17mr749486ooe.71.1610019240097;
Thu, 07 Jan 2021 03:34:00 -0800 (PST)
In-Reply-To:
Received-SPF: pass client-ip=2607:f8b0:4864:20::c36;
envelope-from=p.stephani2@gmail.com; helo=mail-oo1-xc36.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
Xref: news.gmane.io gmane.emacs.help:127047
Archived-At:
Am Do., 7. Jan. 2021 um 12:15 Uhr schrieb Jean Louis :
>
> * Philipp Stephani [2021-01-07 13:07]:
> > Am Do., 7. Jan. 2021 um 08:59 Uhr schrieb Jean Louis =
:
> > >
> > > (defun db/table-id-plist (table id pg)
> > > "Returns plist for table by its table_id"
> > > (let* ((columns (db/table-columns table pg))
> > > (sql (db/sql-by-columns table columns id))
> > > (values (rcd-sql-first sql pg))
> > > (values (append values nil))
> > > (length (length columns))
> > > (plist '()))
> > > (dotimes (i length plist)
> > > (setf plist (plist-put plist (intern (elt columns i)) (elt valu=
es i))))))
> > >
> > >
> > > What is proper way to avoid this warning in `dolist' or `dotimes':
> > >
> > > rcd-db.el:841:1: Warning: Unused lexical variable =E2=80=98i=E2=80=99
> >
> > This is https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D16206. tl;dr:
> > don't use the three-argument form of `dotimes':
> >
> > (dotimes (i length) ; no `plist' here
> > ...)
> > plist
>
> Yes, thank you, that solves the problem.
>
> But it implies that bug should be rather solved as function
> description for `dotimes' allows return value as third argument.
>
> This way is upside down, we tell programmers to not use function that
> was defined as usable.
The discussion in that bug implies that it won't get fixed. Probably
we should discourage the three-argument form more strongly, e.g. by
removing it from the documentation and changing the advertised calling
convention.