Subject: Re: Keyword arguments
From: Erik Naggum <erik@naggum.no>
Date: 1999/09/14
Newsgroups: comp.lang.lisp
Message-ID: <3146303318559517@naggum.no>

* Mark Carroll
| A simple wrapper like,
| 
| (defmacro get-frame-name (frame &key kb)
|   `(if ,kb (gfp::get-frame-name ,frame :kb ,kb)
|      (gfp::get-frame-name ,frame)))

  hmmm.

| (from the USER package) works fine.  However, it stops working if I
| change the first ,kb (after 'if') to t, giving "No methods applicable for
| generic function" for some internal function that get-frame-name calls.

  a more precise reproduction of the error message would probably be a lot
  more revealing of the actual problem.

| What I want to know is, seeing that the call to describe reveals no odd
| default values for GFP:KB, why has the behaviour changed?  Doesn't GFP:KB
| get a value of nil in either case?  I'm sure I'm not understanding
| something fundamental, to be surprised by this.

  I'm not sure you should rely on such information as heavily as you do.
  here's an example that shows you the effect:

CL-USER(85): (defun foo (&key (zot t)))
FOO
CL-USER(86): (arglist #'foo)
(&KEY (ZOT T))
T
CL-USER(87): (compile **)
; While compiling FOO:
Warning: Variable ZOT is never used.
FOO
T
NIL
CL-USER(88): (arglist #'foo)
(&KEY ZOT)
T

  first of all, I don't understand theneed for your wrapper.  if it does
  what you show us in that example, you could just import the symbol and
  get rid of the problem.  but supposing there's any use for this wrapper
  in the first place, I'd do something very similar to this:

(defmacro get-frame-name (&rest args)
  `(gfp::get-frame-name ,@args))

#:Erik