emacs-devel
[Top][All Lists]
Advanced

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

Re: Negative nth index


From: Stefan Kangas
Subject: Re: Negative nth index
Date: Wed, 25 Dec 2024 08:23:59 -0600

Pip Cet <pipcet@protonmail.com> writes:

> I didn't know that.  We specifically undocumented it in 2013, as it
> turns out (3e6b67c9b7230bf10219082d9215d9617a33715e):
>
> 2013-08-13  Glenn Morris  <rgm@gnu.org>
>
>       * lists.texi (List Elements):
>       Undocument behavior of nth and nthcdr with n < 0.  (Bug#15059)
>
> I agree with the statement in that bug thread: All hope is lost.  We
> can't fix it and it is broken, and now we're stuck with permanent harm.
> The only thing it's good for now is to serve as a cautionary tale.

We could warn in the byte-compiler, at least for constant arguments (as
futile as that would be), or we could introduce a new runtime warning.

But I'm not exactly sure that it would be worth the trouble.

>>> If it were merely undocumented, I might agree, but the current behavior
>>> doesn't match the documentation,
>>
>> Yes, the manual and doc strings could certainly be improved.
>
> By reverting that commit?

Perhaps the least intrusive thing we could do is to document the current
behavior, and say that this is an unfortunate historical accident that
no Lisp program should ever rely on.



reply via email to

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