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 #20 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: 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 11:03:01 -0400
[Message part 1 (text/plain, inline)]

On 2018-06-04 18:58, Noam Postavsky wrote:
> X is an optional macro parameter, so the "optionalness" applies at
> compile time.

I think I see what you mean, but I'm not entirely convinced (in part because the docstring doesn't say so, and in part because it doesn't seem worth it to break referential transparency: if we accept nil, we should also accept a variable that evaluates to nil).

> I think that would approximately double the cost of cl-incf in the
> simple case.  And since you would expect cl-incf to be used in loops a
> lot, that seems like a bad idea.

I think we could still optimize the case in which we get an explicit nil.

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.