emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should undefined behavior be encouraged in Emacs?


From: Alan Mackenzie
Subject: Re: Should undefined behavior be encouraged in Emacs?
Date: Mon, 3 Oct 2011 09:20:46 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Stefan.

On Sun, Oct 02, 2011 at 11:11:58PM -0400, Stefan Monnier wrote:
> > The argument given for undefined behavior is that it simplifies
> > maintenance of Emacs internals.

> I like to keep some corner of the behavior undefined, when I think
> that user code that depends on such details is undesirable (e.g. return
> values of primitives which are only called for side-effects).

There are few functions called solely for side effects.  For example,
`goto-char' is frequently found thusly:

(and
 ...
 ...
 (goto-char anchor-point)
 ...
 ...)

.  Strictly speaking this behaviour is undefined because the return
value (which everybody knows to be anchor-point) is undefined.  Strictly
speaking, one has to write it like this:

(and
 ...
 ...
 (progn (goto-char anchor-point) t)
 ...
 ...)

, which is a pain in the alist.  Surely the return value of things like
`goto-char' should be defined?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]