From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: trunk r113818: lisp/xml.el (xml-parse-tag-1): Use looking-at. Date: Tue, 13 Aug 2013 04:55:32 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1376362578 6753 80.91.229.3 (13 Aug 2013 02:56:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Aug 2013 02:56:18 +0000 (UTC) Cc: Lars Magne Ingebrigtsen , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 13 04:56:21 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V94mR-0004zg-Oa for ged-emacs-devel@m.gmane.org; Tue, 13 Aug 2013 04:56:19 +0200 Original-Received: from localhost ([::1]:48346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V94mR-0000FK-Am for ged-emacs-devel@m.gmane.org; Mon, 12 Aug 2013 22:56:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V94mO-0000F3-8B for emacs-devel@gnu.org; Mon, 12 Aug 2013 22:56:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V94mN-0000h3-EF for emacs-devel@gnu.org; Mon, 12 Aug 2013 22:56:16 -0400 Original-Received: from mail-ea0-x22d.google.com ([2a00:1450:4013:c01::22d]:51081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V94mL-0000g9-SF; Mon, 12 Aug 2013 22:56:13 -0400 Original-Received: by mail-ea0-f173.google.com with SMTP id g10so3824471eak.4 for ; Mon, 12 Aug 2013 19:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=0ZXIxZvL53ta96XBGkMhtqHIJk47LJEs5WXvsozk88g=; b=v3hwLFq7Yi9NEPC1y8v/GOx9ge3ItmAjEApTmaloliKemVgyf5L4lEJ3zIeXQLflMs bxeKUYhy9/moFl41MWrCDC97E8ZLPFWIR8Mgj/MaWFKIWFHXjMNYtZpbLOdQYx6wwbHE rc9H4eM03AiI89SlfnbRUh0k/9FskoA0oWG5Me4K6y3gFMUIu7lUnBO4Li3wavWft4PF f8lBm8RKJ9u5GKh1fvqAP9DW48b1ozpqXIeYsepiWWgW+4N4Q/qntPk9BKLQzkOas0QS M+Z2ji526wWPDe1lK6XCA5jumJizrZKq8DEKYEMennMUag6CayzvOIFry4afYGnUjJil YIHQ== X-Received: by 10.14.223.1 with SMTP id u1mr2995645eep.10.1376362572368; Mon, 12 Aug 2013 19:56:12 -0700 (PDT) Original-Received: by 10.14.133.15 with HTTP; Mon, 12 Aug 2013 19:55:32 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162645 Archived-At: On Tue, Aug 13, 2013 at 3:46 AM, Stefan Monnier wrote: > BTW, another thing to learn for this is that we shouldn't bother to > replace looking-at with looking-at-p. > > It can be handy to use looking-at-p if it saves us from using > save-match-data, but other than that it's not worth the trouble. I disagree, as I explained before, because I think the greatest benefit of string-match-p / looking-at-p is that they are predicates. They're easier to interpret, because you can then forget about ugly cases like the one which prompted this thread, were the call to the match-data setting function and its use are quite far apart; that's error prone, not only to the reader, but to the maintainer that can easily insert code in between without realizing the mistake. I don't go out of my way to do the switch, but if I'm fixing other things or typos or whatever and I find them, and they clearly are used as predicates, I change them. Every now and them I overlook a use of match-data, but usually the error is promptly caught. J