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: string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.] Date: Mon, 24 Jun 2013 18:16:25 +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 1372090636 17873 80.91.229.3 (24 Jun 2013 16:17:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Jun 2013 16:17:16 +0000 (UTC) Cc: Emacs developers To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 24 18:17:16 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 1Ur9S7-0007hk-SA for ged-emacs-devel@m.gmane.org; Mon, 24 Jun 2013 18:17:15 +0200 Original-Received: from localhost ([::1]:33357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur9S7-00071L-9C for ged-emacs-devel@m.gmane.org; Mon, 24 Jun 2013 12:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur9S3-0006x2-0E for emacs-devel@gnu.org; Mon, 24 Jun 2013 12:17:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur9S0-0003nA-S4 for emacs-devel@gnu.org; Mon, 24 Jun 2013 12:17:10 -0400 Original-Received: from mail-ea0-x233.google.com ([2a00:1450:4013:c01::233]:49657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur9Rz-0003lL-6w; Mon, 24 Jun 2013 12:17:07 -0400 Original-Received: by mail-ea0-f179.google.com with SMTP id b15so6208915eae.24 for ; Mon, 24 Jun 2013 09:17:06 -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=q+6Ot5waFjGZ4GMsHlzoMu7wsKvlfu6qg06MfTDvOPU=; b=fSt3BDz8RPE0cUH3ZoYxuHSqZ0tB2O1X0dqOSwTpAHONpzwYx8S9jC7IX8TJyBr1I2 MdrFJllo7psybKIwhusKaNypTA+d0+0nvD8QNH6P0J2j/ItczVp19Kj7/yU1F4fnw+xG Hv6lH2xMtVeOsdQCLe+Tl3KNYYCVpYJZrnLd4xZ+1BOOL0LvXwVeSUHPEAEF2p2dKFeP xcpVC4R6nHj+PSLatfZ/k7681JiA/eRTueZ7t1qgZV3mlawlV/32X+OqGn8oa5SO0nNH V1ltY3Qk3G0izddyd0kgMWVp5jO5F8o37HBrRBHywHbUpQ0+uId/wkvcOARFFxHp/KfX ZUdw== X-Received: by 10.15.36.133 with SMTP id i5mr25734513eev.52.1372090625979; Mon, 24 Jun 2013 09:17:05 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Mon, 24 Jun 2013 09:16:25 -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::233 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:160947 Archived-At: On Mon, Jun 24, 2013 at 6:12 PM, Glenn Morris wrote: > If I don't care about the match data one way or the other (as here, I > assume) why is string-match-p preferable? Is it faster or something? If we consider (as we do) that save-match-data is expensive enough that we only do when necessary, I'd assume not registering the match data is faster than registering it, yes. But anyway, the main reason is legibility. If you encounter string-match-p or looking-at-p you can be confident that they are being used as predicates and the following code does not depend on the match data. That is a net gain IMO. J