GNU bug report logs - #67580
29.1; Anomaly in cl-destructuring-bind &rest handling

Previous Next

Package: emacs;

Reported by: Lassi Kortela <lassi <at> lassi.io>

Date: Sat, 2 Dec 2023 06:45:02 UTC

Severity: normal

Found in version 29.1

To reply to this bug, email your comments to 67580 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67580; Package emacs. (Sat, 02 Dec 2023 06:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lassi Kortela <lassi <at> lassi.io>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 02 Dec 2023 06:45:02 GMT) Full text and rfc822 format available.

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

From: Lassi Kortela <lassi <at> lassi.io>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; Anomaly in cl-destructuring-bind &rest handling
Date: Sat, 2 Dec 2023 02:38:41 +0200
;; These three return the first value to which `a' was bound, which is
;; probably OK.

(cl-destructuring-bind (a &rest a) (list 1 2 3 4)
  a)
;; => 1

(cl-destructuring-bind (b a &rest a) (list 1 2 3 4)
  a)
;; => 2

(cl-destructuring-bind (a b &rest b) (list 1 2 3 4)
  a)
;; => 1

;; These two produce the anomaly. When the &rest parameter has the
;; same variable same as a positional parameter, and there are at
;; least two positional parameters, then &rest tries to decode the
;; list tail from whatever value was first assigned to the variable by
;; a positional parameter.

(cl-destructuring-bind (a b &rest a) (list 1 2 3 4)
  a)
;; error: (wrong-type-argument listp 1)

(cl-destructuring-bind (a a &rest a) (list 1 2 3 4)
  a)
;; error: (wrong-type-argument listp 1)




This bug report was last modified 154 days ago.

Previous Next


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