From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Discrepancy in definition/use of match-data? Date: Fri, 11 Jun 2004 21:51:06 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1087005087 29303 80.91.224.253 (12 Jun 2004 01:51:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 12 Jun 2004 01:51:27 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Jun 12 03:51:19 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BYxfz-0001XO-00 for ; Sat, 12 Jun 2004 03:51:19 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BYxfz-0006bX-00 for ; Sat, 12 Jun 2004 03:51:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BYxgj-0003Qi-Uv for emacs-devel@quimby.gnus.org; Fri, 11 Jun 2004 21:52:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BYxge-0003Pe-87 for emacs-devel@gnu.org; Fri, 11 Jun 2004 21:52:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BYxgc-0003OE-6z for emacs-devel@gnu.org; Fri, 11 Jun 2004 21:51:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BYxgc-0003Nt-14 for emacs-devel@gnu.org; Fri, 11 Jun 2004 21:51:58 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BYxfn-0001tW-Cf for emacs-devel@gnu.org; Fri, 11 Jun 2004 21:51:07 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1BYxfm-0007Rn-Tl; Fri, 11 Jun 2004 21:51:06 -0400 Original-To: David Kastrup In-reply-to: (message from David Kastrup on 11 Jun 2004 01:56:39 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24850 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24850 Now the obvious solution to that would be to make unsuccessful matches void the match-data, too. That might be a good thing to do, except that doing it now is likely to delay the release. So my proposal is the following plan: Before next release: match-data gets voided upon entry of a filter or sentinel, like it is being done now. With void match-data, match-beginning and so on flag an error irrespective of their argument. The match-data is only touched by a successful match. Once a match has been successful, match-beginning and so on will not flag errors for positive arguments, but return nil (as documented). In order to have a better chance of catching such use-before-valid-match situations, it might be a good idea also to void the match-data in the main loop. Voiding in the main loop was exactly the idea that occurred to me. So let's do all of this now. After the next release, I would like to have unsuccessful matches also void the match-data, making the use of the above quoted idiom illegal. I agree. (But please, let's say "cause an error", not "illegal". Nobody is going to be jailed for doing this.) We should do this change right after the next release so that Emacs core developers and those for add-on packages have enough time testing it, finding the problematic code and fixing it for the next release after that. We could do it right now in the Unicode branch. That way, we'd assure it will get into the following major release, but detection of code that needs changing could start right away.