[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can defgeneric provide defaults for &key args
- To: Common-Lisp-Object-System@sail.stanford.edu
- Subject: Can defgeneric provide defaults for &key args
- From: Danny Bobrow <Bobrow.pa@Xerox.COM>
- Date: 1 Oct 87 10:52 PDT
- Cc: Bobrow.pa@Xerox.COM
- Sender: Bobrow.pa@Xerox.COM
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)
...)