From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 02 01:44:43 2023 Received: (at submit) by debbugs.gnu.org; 2 Dec 2023 06:44:43 +0000 Received: from localhost ([127.0.0.1]:56543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9Jk1-0005x3-16 for submit@debbugs.gnu.org; Sat, 02 Dec 2023 01:44:43 -0500 Received: from lists.gnu.org ([2001:470:142::17]:50554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9E78-0007iO-Qh for submit@debbugs.gnu.org; Fri, 01 Dec 2023 19:44:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9E6s-0001Nf-VH for bug-gnu-emacs@gnu.org; Fri, 01 Dec 2023 19:43:55 -0500 Received: from mail-108-mta179.mxroute.com ([136.175.108.179]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r9E6r-0001GZ-2l for bug-gnu-emacs@gnu.org; Fri, 01 Dec 2023 19:43:54 -0500 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta179.mxroute.com (ZoneMTA) with ESMTPSA id 18c27f6a683000190b.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 02 Dec 2023 00:38:45 +0000 X-Zone-Loop: accd37755733454789d1f13c1426ab4c1a540048a7ee X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lassi.io; s=x; h=Content-Transfer-Encoding:Content-Type:From:Subject:To:MIME-Version: Date:Message-ID:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=5UwVaEo+HLSHioINACGHZOvO9V9Lw6wL1RKnw6Ar29k=; b=F PU87Tcw411mJ6q/36BELFF39px3/ns/enR9K0kkqPYcRbKcPnvlAwZQ3TS6K0z1MIRQeK8wm7pVQz kaCilmeYVMR2/kkMD6kV8JxwvAzzHS22Z03eOjVvseWUkoJ0I0CbFlWNcYQCnydhFUEs1XSQAzu+m u0zj+vOc2vI9wV2oUHFXotIKRUOnFNw83QvbUneXoSnRxgORAAQkW6Zru1JGUmHJSBYt2SCBeobuA MlIs6X2kTBZE4IWSLeFeE8Xre3liEX1ssg0AAxFE3a8QQj25dMK7gfaDg9lz3FBwu6UvkpaTUe6YH SQcx26BPOfWRYkjPXHa/dIR376uHel5cQ==; Message-ID: Date: Sat, 2 Dec 2023 02:38:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: bug-gnu-emacs@gnu.org Subject: 29.1; Anomaly in cl-destructuring-bind &rest handling Content-Language: en-US From: Lassi Kortela Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Authenticated-Id: lassi@lassi.io Received-SPF: pass client-ip=136.175.108.179; envelope-from=lassi@lassi.io; helo=mail-108-mta179.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 02 Dec 2023 01:44:40 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) ;; 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)