GNU bug report logs - #79396
30.1; cl-copy-list can error but is declared as error-free

Previous Next

Package: emacs;

Reported by: mail <at> kisaragi-hiu.com

Date: Sat, 6 Sep 2025 17:42:02 UTC

Severity: normal

Found in version 30.1

Done: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mail <at> kisaragi-hiu.com, 79396 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#79396: 30.1; cl-copy-list can error but is declared as error-free
Date: Sun, 7 Sep 2025 11:05:06 +0200
mail--- dixit:

> cl-copy-list can error if given a value that isn't nil or a cons cell,
> like (cl-copy-list 3), as expected. However, the function was declared
> (side-effect-free error-free), which contradicts this.

The error-free declaration is clearly wrong. Sorry about that, and thanks for reporting it.

However, the CL spec doesn't really mandate a specific behaviour when the argument is not a list, so one alternative would be to just have it return its argument in that case. It's attractive because the behaviour would be very clean:

  (cl-copy-list (A . B)) = (cons A (cl-copy-list B))
  (cl-copy-list ATOM) = ATOM

In a way, an atom is the base case of a dotted list.
After such a change, cl-copy-list might qualify as error-free. It will still diverge if given a circular list though.

(CC:ing Stefan in case he has a preference.)





This bug report was last modified 3 days ago.

Previous Next


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