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

Can defgeneric provide defaults for &key args



Consider the following example of the new regime with lambda list
congruence.
I don't think the rules allow a default value to be specified for a
keyword argument in defgeneric now, even though all methods must accept
such keys?  Should it be allowed to support a uniform default?

Example:

  (defgeneric width &key (scale-factor 1))

  (defmethod width ((s string) &key scale-factor (font *standard-font*))
     ...)

  (defmethod width ((s bitmap) &key scale-factor paint-fn)
     ...)

The alternative is:

  (defgeneric width &key scale-factor)

  (defmethod width ((s string)
      &key  (scale-factor 1)(font *standard-font*))
   ...)

  (defmethod width ((s bitmap)
      &key (scale-factor 1) paint-fn)
   ...)