GNU bug report logs - #3647
23.1.50; defun* generates incorrect code for handling arglist keyword lookup

Previous Next

Package: emacs;

Reported by: Miles Bader <miles <at> gnu.org>

Date: Mon, 22 Jun 2009 06:50:04 UTC

Severity: normal

Tags: confirmed

Done: Daniel Colascione <dancol <at> dancol.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Miles Bader <miles <at> gnu.org>
Cc: 3647 <at> debbugs.gnu.org
Subject: bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup
Date: Sat, 17 Sep 2011 08:19:24 +0200
Miles Bader <miles.bader <at> necel.com> 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/




This bug report was last modified 11 years and 121 days ago.

Previous Next


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