GNU bug report logs - #31715
cl-incf and cl-decf error out when passed a nil-valued variable as 'offset'

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <clement.pitclaudel <at> live.com>

Date: Mon, 4 Jun 2018 20:08:01 UTC

Severity: minor

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 31715 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 31715 <at> debbugs.gnu.org
Subject: Re: bug#31715: cl-incf and cl-decf error out when passed a nil-valued
 variable as 'offset'
Date: Tue, 5 Jun 2018 19:01:56 -0400
[Message part 1 (text/plain, inline)]
On 2018-06-05 18:53, Noam Postavsky wrote:
> Both SBCL and CLisp throw an error for (let ((x 1) (y nil)) (incf x y)),
> although I can't see anything in the Common Lisp spec to decide either
> way.  E.g., cltl2 says:
> 
>     If delta is not supplied, then the number in place is changed by 1.
> 
> https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node125.html

Thanks for looking up the spec and testing other implementations.  I'm not sure what to make of the result with SBCL and CLisp, since (incf x nil) also fails in both of them (whereas it works for us, since we can't distinguish nil and unspecified).

>> In the rest of Emacs there are lots of other examples.  Many of them
>> (for example semantic-find-tags-by-name or calendar-increment-month)
>> seem to work when passed a nil-valued variable, but many others behave
>> like cl-incf (for example gnus-summary-article-score).
> 
> I don't think those are great examples of macros to emulate.

Agreed, I was just collecting other examples, both in support and against my point.

Clément.

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 3 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.