[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#3647: 23.1.50; defun* generates incorrect code for handling arglist

From: Lars Magne Ingebrigtsen
Subject: bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup
Date: Sat, 17 Sep 2011 08:19:24 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Miles Bader <address@hidden> 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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]