Hi all,
Consider the following:
(defun fun (&key arg)
(declare (ignore arg))
nil)
(defun (setf fun) (value &key arg)
(declare (ignore arg value))
nil)
(push 'a (fun :arg 'bla))
This gives the following note when executing this (I am using CMUCL):
; Note: The first argument (in keyword position) is not a constant.
If I check the macroexpansion of the last form, I can see where it
comes from:
(macroexpand-1 '(push 'a (fun :arg 'bla)))
(LET* ((#:G2520 'A)
(#:G2519 :ARG)
(#:G2518 'BLA)
(#:G2517 (CONS #:G2520 (FUN #:G2519 #:G2518))))
(FUNCALL #'(SETF FUN) #:G2517 #:G2519 #:G2518))
T
It evaluates ':arg' to make sure it gets evaluated only once, but then
the keyword argument to (setf fun) is no longer a constant.
Is there any way to get rid of the note?
Am I doing something else wrong?
Thanks,
Kris
From: Brian Downing
Subject: Re: Note: The first argument (in keyword position) is not a constant.
Date:
Message-ID: <xFO7f.516349$xm3.80560@attbi_s21>
In article <·······················@g14g2000cwa.googlegroups.com>,
·············@gmail.com <·············@gmail.com> wrote:
> This gives the following note when executing this (I am using CMUCL):
> ; Note: The first argument (in keyword position) is not a constant.
>
> If I check the macroexpansion of the last form, I can see where it
> comes from:
This doesn't happen in SBCL, so it's probably either behavior that was
fixed in SBCL or a warning that was added in CMUCL after the fork.
While a CMUCL developer might notice it here, it'd be more useful for
you to send this to one of the CMUCL mailing lists (probably cmucl-imp):
http://www.cons.org/cmucl/support.html
-bcd
--
*** Brian Downing <bdowning at lavos dot net>