From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: find-file-noselect needs save-match-data Date: Sun, 10 Jun 2007 08:05:41 +0800 Message-ID: References: <4669246B.2060801@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1181433955 27553 80.91.229.12 (10 Jun 2007 00:05:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Jun 2007 00:05:55 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, monnier@iro.umontreal.ca To: rudalics@gmx.at, storm@cua.dk Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 10 02:05:53 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HxAwJ-00034n-Ee for ged-emacs-devel@m.gmane.org; Sun, 10 Jun 2007 02:05:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxAwJ-00013o-1o for ged-emacs-devel@m.gmane.org; Sat, 09 Jun 2007 20:05:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HxAwF-00013Z-Dk for emacs-devel@gnu.org; Sat, 09 Jun 2007 20:05:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HxAwE-00013N-IN for emacs-devel@gnu.org; Sat, 09 Jun 2007 20:05:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxAwE-00013K-GF for emacs-devel@gnu.org; Sat, 09 Jun 2007 20:05:46 -0400 Original-Received: from bay0-omc1-s16.bay0.hotmail.com ([65.54.246.88]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HxAwC-0000sK-Qz; Sat, 09 Jun 2007 20:05:45 -0400 Original-Received: from hotmail.com ([65.55.154.106]) by bay0-omc1-s16.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sat, 9 Jun 2007 17:05:43 -0700 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sat, 9 Jun 2007 17:05:43 -0700 Original-Received: from 65.55.154.123 by by143fd.bay143.hotmail.msn.com with HTTP; Sun, 10 Jun 2007 00:05:41 GMT X-Originating-IP: [221.223.221.161] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: <4669246B.2060801@gmx.at> X-OriginalArrivalTime: 10 Jun 2007 00:05:43.0305 (UTC) FILETIME=[16682F90:01C7AAF3] X-detected-kernel: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72556 Archived-At: > > It's quite the opposite IMO. "safe" can mean many things, whereas > > "nodata" clearly indicates that it doesn't set (or modify) match-data. > >"-nodata" is good. > > > But in practice, we should have a macro to encapsulate calls: > > > > (preserve-match-data (string-match ...)) > >This would violate referential transparency. Consider > >(defvar foobar "foobar") > >(defun foo () > (string-match "foo" foobar) > (match-string 0 foobar)) > >(defun bar () > (string-match "bar" foobar) > (preserve-match-data > (foo))) Since most applications do not use the match data in practice, I think if an application use the match data, it should require it explicitly. I.e., please take a look at the following: ;; Normal applications (no use of match data). (if (string-match "foo" bar) ;; True branch. ;; False branch.) (foo-bar) ;; Applications that use match-data. (if (string-match "foo" bar) (with-match-data (match-data) ;; True branch.) ;; No need to use `with-match-data' here, since there is no ;; match data. ;; False branch.) (foo-bar) IMO, if we can adapt to this model easily, we can make least changes to existing code. Regards, Guanpeng Xu _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/