From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup Date: Sat, 17 Sep 2011 08:19:24 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1316241512 19934 80.91.229.12 (17 Sep 2011 06:38:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 17 Sep 2011 06:38:32 +0000 (UTC) Cc: 3647@debbugs.gnu.org To: Miles Bader Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 17 08:38:26 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4oXh-00067u-5j for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Sep 2011 08:38:25 +0200 Original-Received: from localhost ([::1]:36069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4oXg-0005zV-LV for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Sep 2011 02:38:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4oXd-0005xw-Fg for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2011 02:38:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4oXc-0005Jb-6S for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2011 02:38:21 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4oXb-0005JN-Rr for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2011 02:38:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R4ocE-00063l-Vz; Sat, 17 Sep 2011 02:43:07 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Magne Ingebrigtsen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Sep 2011 06:43:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3647 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 3647-submit@debbugs.gnu.org id=B3647.131624177923251 (code B ref 3647); Sat, 17 Sep 2011 06:43:06 +0000 Original-Received: (at 3647) by debbugs.gnu.org; 17 Sep 2011 06:42:59 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4obs-00062e-5Y for submit@debbugs.gnu.org; Sat, 17 Sep 2011 02:42:52 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4obi-00061z-Fr for 3647@debbugs.gnu.org; Sat, 17 Sep 2011 02:42:36 -0400 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R4oWx-0003OA-HP; Sat, 17 Sep 2011 08:37:39 +0200 In-Reply-To: (Miles Bader's message of "Mon, 22 Jun 2009 15:45:29 +0900") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-Now-Playing: Laura Jean's _Tour EP, 2009_: "When I See You" X-MailScanner-ID: 1R4oWx-0003OA-HP MailScanner-NULL-Check: 1316846259.64574@cDYfZOrDB2hTeKD9AanSMg X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 17 Sep 2011 02:43:06 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51265 Archived-At: Miles Bader writes: > Please describe exactly what actions triggered the bug > and the precise symptoms of the bug: > > Given the following code: > > (require 'cl) > (defun* oink (&key a b) (list a b)) > > then evaluating: > > (oink :b :a :a 42) > => (:a :a) > > ... which is incorrect. The correct answer is (42 :A). I can confirm that this bug is still present in Emacs 24. > Looking at the macro-expansion of the above defun* form, the reason is > obvious: the generated code uses (car (cdr (memq KEYWORD ARGLIST))) to > look up keyword argument values, which is obviously bogus if a preceding > argument value is the same as a keyword. It would be more correct to > use (plist-get ARGUMENT KEYWORD), and that's what common-lisp systems I > tested return for this test. > > However, the code in cl.el that generates keyword handling code is so > confusing, I'm not really sure how to fix this; presumably something in > `cl-do-arglist'? Hm. I think that function could do with some well-placed comments. :-) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/