From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#16206: 24.3; Incorrect unused variable byte-compiler warning in dotimes Date: Mon, 23 Apr 2018 01:29:25 +0300 Organization: LINKOV.NET Message-ID: <874lk26fjt.fsf@mail.linkov.net> References: <87ob4bxme9.fsf@susie.zeus.nullprogram.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1524436149 8660 195.159.176.226 (22 Apr 2018 22:29:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Apr 2018 22:29:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Christopher Wellons , 16206@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 23 00:29:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fANTl-0002Bb-9L for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Apr 2018 00:29:05 +0200 Original-Received: from localhost ([::1]:39388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fANVs-0003iA-4i for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Apr 2018 18:31:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fANVh-0003hE-96 for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 18:31:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fANVe-00022A-5Z for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 18:31:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56539) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fANVe-000223-1F for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 18:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fANVd-0001Dm-MN for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 18:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Apr 2018 22:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16206-submit@debbugs.gnu.org id=B16206.15244362504677 (code B ref 16206); Sun, 22 Apr 2018 22:31:01 +0000 Original-Received: (at 16206) by debbugs.gnu.org; 22 Apr 2018 22:30:50 +0000 Original-Received: from localhost ([127.0.0.1]:36203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fANVS-0001DN-9m for submit@debbugs.gnu.org; Sun, 22 Apr 2018 18:30:50 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:38978 helo=homiemail-a23.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fANVR-0001DF-64 for 16206@debbugs.gnu.org; Sun, 22 Apr 2018 18:30:49 -0400 Original-Received: from homiemail-a23.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTP id 5058C4B0063; Sun, 22 Apr 2018 15:30:48 -0700 (PDT) Original-Received: from localhost.linkov.net (m91-129-96-255.cust.tele2.ee [91.129.96.255]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPSA id 3982D4B0062; Sun, 22 Apr 2018 15:30:46 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 22 Dec 2013 21:48:50 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:145677 Archived-At: >> When `lexical-binding' is t the byte-compiler issues an invalid warning >> for `dotimes' when the optional "result" form is used. For example, >> byte-compile a file with these contents. > >> ;;; -*- lexical-binding: t; -*- >> (defun foo () >> (dotimes (i 1 t) i)) > > Indeed. This is a known problem. I strongly recommend you don't use > this third argument unless it makes use of `i' (which is basically the > only case where it's useful, AFAIK). I can't imagine a case when `i' could be useful in the third argument, because after the last loop `i' is just equal to the COUNT arg, i.e. instead of `i' (let ((count 10)) (dotimes (i count i) (print i))) it's clearer to use `count' (let ((count 10)) (dotimes (i count count) (print i))) in cases when the result depends only on the value of `count'. But in most cases the result is calculated inside the body as demonstrated by examples in (info "(eintr) dotimes") So maybe better to fix the line marked in the implementation of `dotimes' by FIXME?