From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Leo Butler Newsgroups: gmane.emacs.help Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? Date: Sat, 09 Jan 2021 07:15:00 -0600 Message-ID: <868s92ntez.fsf@x201.butler.org> 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="34085"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 14:31:18 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 1kyEKs-0008oJ-2h for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 14:31:18 +0100 Original-Received: from localhost ([::1]:55640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyEKr-0000cJ-2U for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 08:31:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyEJv-0000bx-TM for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 08:30:20 -0500 Original-Received: from mail-eopbgr670125.outbound.protection.outlook.com ([40.107.67.125]:13619 helo=CAN01-TO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyEJo-0000yj-D4 for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 08:30:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CmPLCY/JP22UPC8yLttDcQZs40Jb+kEfdQOWDpIk8aO543bbw0qxRSF9Ws66hfMvKgh5ySJk7gpwa306KyE0EKGzdXiY16+CEsGD353BV8E2+9g231N3zj+4joXzQK37rjBScJ4J+krqirGXGewDZ4H6xNG8iZBEeqIp5UeTmuEqFuBrG2xAiu5I/pTIEpwRP+KT+7Y/3vMqP72y/Lv5lFZ9ZT0O9IitdiKS/ZFv801moeYh7jh4H4N8K6lVGcDvvnxPYbE0T9c5bwDETcWzqOF/CrLywiWonX7YsAxKPl8vabuiQyvTbt9QC7vNbgMnHdUGmdbsvNavC9xENvbnOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KEwrtqaYXj5Sow1Q1Pj/8hPzXrSn6gLKD2vgIf5R6OA=; b=Vz2EhPUUulX7i3wgdx+sORaSjIIfv4ms5g1ATkM4W+ZzLBFuAe21VZyesiSgpeH6VD0bpJjOGTPecb8nD4gxQIpDoMlfApJ4ZwWqx6lFf2/tgf4gqTN0hjop2ZUZ9uLIPz8qrngpmmN+8dr8b6kCIWAhSLInEiu/sogifj+IXW89g0von7frfWa+f5yFSgM3iL3uk2C2J18M71nPR3vmYghHTBM2JUARHyytk7KS/+CXDb7vYtnIDDnkz6aci/ORDfAuFzpYsKFdBjRg1dCN2+xYBWpMBpkZ2tLVIpkAzDCx12ECYu5VOzV/oJsT875DZhBsbgBmpBQNoqJi5zFMCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=umanitoba.ca; dmarc=pass action=none header.from=umanitoba.ca; dkim=pass header.d=umanitoba.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umanitoba.onmicrosoft.com; s=selector2-umanitoba-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KEwrtqaYXj5Sow1Q1Pj/8hPzXrSn6gLKD2vgIf5R6OA=; b=EQC4xs9n6I0snaD5p+jTQ4B+5ntzXHaDy1cvcq0z9dVsdy6BxXwDk9aT0XY9cWIL8WpVGdMrIhTExZs+P/4vnSu7IoNDycCgOxBYSKCfqEH977rU6DIxUYaElOVHva9BcFJd4DKPUoIL9EDZzRVTiffT+5w8AsZe4Aep7LMSn0o= Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=umanitoba.ca; Original-Received: from YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:21::31) by YT1PR01MB4089.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Sat, 9 Jan 2021 13:15:04 +0000 Original-Received: from YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM ([fe80::e557:4be:b224:e3ca]) by YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM ([fe80::e557:4be:b224:e3ca%4]) with mapi id 15.20.3742.012; Sat, 9 Jan 2021 13:15:04 +0000 In-Reply-To: (Jean Louis's message of "Sat, 9 Jan 2021 10:55:57 +0300") X-Originating-IP: [45.44.33.194] X-ClientProxiedBy: MWHPR04CA0027.namprd04.prod.outlook.com (2603:10b6:300:ee::13) To YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:21::31) X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from x201 (45.44.33.194) by MWHPR04CA0027.namprd04.prod.outlook.com (2603:10b6:300:ee::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Sat, 9 Jan 2021 13:15:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14a527c1-c705-47c1-9039-08d8b4a09412 X-MS-TrafficTypeDiagnostic: YT1PR01MB4089: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y/Paa16HIgHoBqeb/hGZttorjwPILEKQXQZOtK2Hq0KPSuBvfX79twNPbq7Qepf9z2iPktVC4LBIh2DGpgBhyFnLFnpzhqEfBl2g3Tb8aa5UdY5yinXYuIEphprBCw0luxdqkdBNdvlU28RE99yr20XDgL3ZcQRRYgesweAictR3LoPEEbIogNkmu98gA6kUeaFSL6pBmNluz6ZfgwTLgu/OV10/qMhWDkVqNn8r6SlN1tXs8UmQBrsyi3ekG7gW9X0+vbpt9Kp6HJn9R1lfbcp6fMB3FSMZ81VPFRGIjeCHh+Za9a5wO7PmILm84ubbpCwM5yhUJBegoUf9C8uNFZ2JYUugUqtPSDrKxCSgDACyLhz0xlLcBcbMpw0JNm0p8fXtcYzRLsYiz6E7itNBYWDKEIMBU5BokZLBhmhJ2LkiW8K+/Na1Sefe2TsGs3OA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(376002)(366004)(396003)(346002)(39860400002)(136003)(8936002)(316002)(786003)(86362001)(5660300002)(52116002)(6496006)(478600001)(66556008)(66476007)(66946007)(2906002)(8676002)(16526019)(186003)(956004)(6916009)(44832011)(6486002)(26005)(9686003)(83380400001)(81973001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?WUxnZG9YU29wakh1R2tCWnR4NERKdWZiYktmK1AwNVFxaTM2NzRCRDY1Ri9P?= =?utf-8?B?MjBjaGZxblZINEpjTGRjaWVLMzd2Y2hnQklrZHN6Uklpdk9HeGhzcnZuSVpS?= =?utf-8?B?akxzU3FxdTkySm1VYkFhcis5K0EwKzdDRE44RGNEKzdnbXZ2S2p5UVdaMXJw?= =?utf-8?B?SjR2Y0tENEJteUcwR25RQjEvK0VySTNidDFxVU9DSjNjek5mMkpndFIxa3V6?= =?utf-8?B?QmoxNVN3Zk4rZHZObU9MdnBDZmM4OWtqb1BNa1g1NkpEeXl6VXI1M1BrbWhN?= =?utf-8?B?Z1pTVHdmNlRMNzdLS0c1bTBIV1VsSVZvdTVDYncwMzNGOTRXcUZoQmh2RWtx?= =?utf-8?B?bDMwU25NdWlHQnBNN0ZoZkd2dmV3TmMyZkdXc0hFTThLY2h3TU83UWFCb3Zo?= =?utf-8?B?dUhkTDhCSG91b3BjMTVZelFkNUxBYWNmdWRMRVRRMHhnQmo1ZXcvRDVLbDlz?= =?utf-8?B?OSsraUI2RkxEYXg2TEZKME1oTDdCcjFza1Q3Sm1sUlhlUVFxNnlUSzVEamU3?= =?utf-8?B?RFFPc3o0dWVWS05VRzE0bi9VSFh0N2d4NVhpbGdIQWU3d00zSHcvQXhHWlBX?= =?utf-8?B?U3BlNVQ1ek1EWlZhblBXY2hRZjRKcGZZcHhIOHEvNklWcmFycHo0ZFBFV040?= =?utf-8?B?QiszTFhIR0x5R1VNUDhJeEhPRDdDZW8weEt6ZXFu X-OriginatorOrg: umanitoba.ca X-MS-Exchange-CrossTenant-AuthSource: YTBPR01MB3053.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2021 13:15:04.3337 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4f80dd0b-338c-4e4c-8a14-90446962f7b8 X-MS-Exchange-CrossTenant-Network-Message-Id: 14a527c1-c705-47c1-9039-08d8b4a09412 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KgnexYN9FW+s/Jn2J0rONDkFZAT0ZVm7QwHxifiUf7Quse/DSDGnoAiLdzLHOTJsQ63hrwaWWm6d6YzTSlRzqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT1PR01MB4089 Received-SPF: pass client-ip=40.107.67.125; envelope-from=Leo.Butler@umanitoba.ca; helo=CAN01-TO1-obe.outbound.protection.outlook.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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:127128 Archived-At: Stefan, I wonder why the lexical-binding version of dotimes is not implemented like: #+begin_src emacs-lisp (let* ((start 0) (end (nth 1 spec)) (counter (gensym)) (body (subst counter (car spec) body))) `(let ((,counter ,start)) (while (< ,counter ,end) ,@body (setq ,counter (1+ ,counter))) ,@ (cddr spec)))) #+end_src I am familiar with the comment in subr.el about uninterned symbols, but TBH, I don't have a sense of where the performance penalty might be of any significant size. Leo Jean Louis writes: > ******************************************************** > Caution: This message was sent from outside the University of Manitoba. > ******************************************************** > > * Stefan Monnier [2021-01-08 10:16]: >> > Only it is not relevant to macro or function that is documented to >> > work, but then again it gives warnings for `n' and not for `return' as >> > in above example.=20 >>=20 >> Not sure what you mean by "documented", but `C-h f dotimes` says: >>=20 >> dotimes is a Lisp macro in =E2=80=98subr.el=E2=80=99. >> =20 >> (dotimes (VAR COUNT [RESULT]) BODY...) >> =20 >> Probably introduced at or before Emacs version 21.1. >> =20 >> Loop a certain number of times. >> Evaluate BODY with VAR bound to successive integers running from 0, >> inclusive, to COUNT, exclusive. >> =20 >> Finally RESULT is evaluated to get the return value (nil if >> RESULT is omitted). Using RESULT is deprecated, and may result >> in compilation warnings about unused variables. >>=20 >> Notice the last sentence. > > Now I do notice it. > > I do switch to `while' and mapping functions rather. > > Jean