From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#9642: move-overlay creates an empty overlay with the evaporate property Date: Sun, 02 Oct 2011 02:56:02 -0400 Message-ID: References: <4E8648C6.5050905@cs.ucla.edu> <4E86C25D.5010108@cs.ucla.edu> <83hb3tce8w.fsf@gnu.org> <4E87F8D0.5090105@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1317538617 20363 80.91.229.12 (2 Oct 2011 06:56:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Oct 2011 06:56:57 +0000 (UTC) Cc: 9642@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 02 08:56:53 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RAFym-0004YH-NR for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2011 08:56:52 +0200 Original-Received: from localhost ([::1]:50117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAFyl-00045C-80 for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2011 02:56:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAFyi-000457-Ix for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2011 02:56:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAFyh-0002GI-Cz for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2011 02:56:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAFyh-0002GD-8y for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2011 02:56:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RAFzu-0006WS-4d for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2011 02:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Oct 2011 06:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9642 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 9642-submit@debbugs.gnu.org id=B9642.131753864725029 (code B ref 9642); Sun, 02 Oct 2011 06:58:01 +0000 Original-Received: (at 9642) by debbugs.gnu.org; 2 Oct 2011 06:57:27 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RAFzK-0006Ve-Gp for submit@debbugs.gnu.org; Sun, 02 Oct 2011 02:57:26 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RAFzE-0006VT-CX for 9642@debbugs.gnu.org; Sun, 02 Oct 2011 02:57:22 -0400 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RAFxy-0005vu-U0; Sun, 02 Oct 2011 02:56:02 -0400 In-reply-to: <4E87F8D0.5090105@cs.ucla.edu> (message from Paul Eggert on Sat, 01 Oct 2011 22:38:24 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 02 Oct 2011 02:58:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:52063 Archived-At: > Date: Sat, 01 Oct 2011 22:38:24 -0700 > From: Paul Eggert > CC: monnier@iro.umontreal.ca, 9642@debbugs.gnu.org > > On 10/01/11 01:22, Eli Zaretskii wrote: > > doing this invokes undefined behavior > > No, everywhere else the overlay code consistently defines > the behavior: out-of-range values are treated as if they were > the nearest in-range values. That is your interpretation of what Emacs does. But this seemingly "consistent" behavior is nothing more than one possible undefined behavior. That it looks to you "consistent" is just an accident. > This behavior is a longstanding Emacs tradition Sorry, but I submit that we should start treating these references to "tradition" as bogus. Upholding such "traditional" misbehavior causes all kinds of unexpected quirks in the code that are very hard to maintain and downright impossible to take into account when designing significant changes. IOW, an attempt to treat such undefined behavior consistently bears grave maintenance costs and in fact stands in the way of any significant progress, because it makes it impossible to produce elegant and simple design of new features that is based on assumptions such as "buffer positions are always between (point-min) and (point-max)." One thinks this must be the case and writes the code based on that, and then the code crashes because some Lisp expected zero to be "traditionally" treated as one. That way lies madness. I say we should fix any code that "traditionally" relies on any such behavior, and stop heeding to requests of fixing undefined behavior. There should be no need for any code to put an overlay starting at position zero nor go to such a position, because these positions simply do not exist. > I suppose it might make sense for the overlay code to consistently treat > out-of-range values as errors, and throw exceptions instead. I didn't say we should throw errors. Undefined behavior is just that--you can expect anything. Including treating 0 as 1 in some cases, but not others. > But what doesn't make sense is for the overlay behavior to be inconsistent It is consistently undefined, from my POV. And that is the only sense I can possibly find in code which does this.