From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: regexp linting run in Emacs tree Date: Mon, 5 Aug 2019 23:18:11 +0200 Message-ID: <642BA39E-FE1C-4345-8027-50445B64EA18@acm.org> References: <3B0BC169-9F40-456F-B249-0ABB43558EEA@acm.org> <2dcc229d-75ce-51df-0224-f484eec622e3@cs.ucla.edu> <1C885731-EC94-47DB-88D6-14C505C1BDF0@acm.org> <1adc8c6d-7e82-6ee6-1ec5-12e387acecb1@cs.ucla.edu> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="183758"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Emacs Development To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 05 23:18:59 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hukNe-000lfO-Gi for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2019 23:18:58 +0200 Original-Received: from localhost ([::1]:57012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hukNc-0000d0-VD for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2019 17:18:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38116) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hukNB-0000ci-Tz for Emacs-devel@gnu.org; Mon, 05 Aug 2019 17:18:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hukNA-0000TJ-UN for Emacs-devel@gnu.org; Mon, 05 Aug 2019 17:18:29 -0400 Original-Received: from mail1421c50.megamailservers.eu ([91.136.14.21]:59660 helo=mail102c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hukNA-0000SK-Ba for Emacs-devel@gnu.org; Mon, 05 Aug 2019 17:18:28 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1565039893; bh=rgyp0m3TFsFuywQJy38mfYGbnemKLcvd3ynKoY3ECwM=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=c8pCWdLiWQC1oUW3JCL+QlAtVmrpISB240vGxA6PvtdNvD52/d26Ua6HsFbpmoKGN EFm84l+TYBznE4/WHSBGULmxOUwbKPvcAW8rqBG3dKEv+ZW11IqZcZTreLQ5wLmty7 vXutzqH453fZwSbOZ+gCL6ykIC1E16HVLLnICo6o= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x75LIBYq026274; Mon, 5 Aug 2019 21:18:13 +0000 In-Reply-To: <1adc8c6d-7e82-6ee6-1ec5-12e387acecb1@cs.ucla.edu> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020C.5D489D15.0029, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=IrUwjo3g c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=SE6gYbTTTVY7nh6DlswA:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.21 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239199 Archived-At: 5 aug. 2019 kl. 19.17 skrev Paul Eggert : >=20 > I'm afraid that'd still be more clutter than it's worth, at least to = me. Well, it's faster than the current code in the common case[*]. It also = reflects the intended semantics better; the current code relies on the = implicit tolerance for duplicates in skip-chars-forward. > Instead, how about changing the delinter to omit this particular = warning if the regexp was computed from a configurable variable (as = opposed to an ordinary variable)? That's a very ad-hoc rule which just happens to fit this very situation = but isn't really causally connected to the false positive in a = reasonable way. It could just as well have occurred in a different way, = or resulted in a different warning. It just goes to show how hard it is = to make an algorithm understand when a human programmer knowingly breaks = the rules to achieve a certain effect. As I see it, it's either the proposed memq change which makes the code = faster and (arguably) clearer, a formal suppressive comment, or seeing = this instance every time (and remembering to ignore it). [*] Benchmarked: (defun f (c) (string c ?\s ?\t)) (defun g (c) (if (memq c '(?\s ?\t)) " \t" (string c ?\s ?\t))) g is about twice as fast as f for c=3D32; less allocation, and memq is a = bytecode op while string isn't.