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

* 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)))


| (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)))
CL-USER(86): (arglist #'foo)
(&KEY (ZOT T))
CL-USER(87): (compile **)
; While compiling FOO:
Warning: Variable ZOT is never used.
CL-USER(88): (arglist #'foo)

  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))