[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
default initargs bug with 5/5/89 PCL
- To: commonloops.pa@Xerox.COM
- Subject: default initargs bug with 5/5/89 PCL
- From: gillett@ai.mit.edu (Walter E. Gillett)
- Date: Fri, 19 May 89 14:17:51 EDT
- Cc: gillett@ai.mit.edu
- Redistributed: commonloops.pa
- Reply-to: <Owners-commonloops.pa@Xerox.COM>
I am running PCL in Allegro CL V3.0.3 on a Tektronix 4319.
I found this bug in the Cinco de Mayo version of PCL:
With DEFAULT-INITARGS, I should be able to provide default values for
any initialization argument, whether it initializes a slot or is
passed to a method. However, the current PCL provides defaults for
method initargs only when either the defclass or the defmethod is
evaluated more than once:
------------------------------------------------------------
Without :default-initargs, I get the behavior I would expect:
<cl> (defclass class1 () ())
NIL
<cl> (defmethod initialize-instance :after ((class1 class1) &key keyword)
(format t "Keyword: ~S~%" keyword))
NIL
<cl> (make-instance 'class1)
Keyword: NIL
#<CLASS1 53032501>
<cl> (make-instance 'class1 :keyword 100)
Keyword: 100
#<CLASS1 53054601>
------------------------------------------------------------
With :default-initargs, however, I get pathological behavior:
<cl> (defclass class2 () () (:default-initargs :keyword 'default))
NIL
<cl> (defmethod initialize-instance :after ((class2 class2) &key keyword)
(format t "Keyword: ~S~%" keyword))
NIL
<cl> (make-instance 'class2)
Error: Invalid initialization argument :KEYWORD for class CLASS2
[1] <cl> :pop
<cl> (make-instance 'class2 :keyword 100)
Error: Invalid initialization argument :KEYWORD for class CLASS2
[1] <cl> :pop
;;; If I reevaluate the defmethod, it starts acting correctly:
<cl> (defmethod initialize-instance :after ((class2 class2) &key keyword)
(format t "Keyword: ~S~%" keyword))
NIL
<cl> (make-instance 'class2)
Keyword: DEFAULT
#<CLASS2 53143741>
<cl> (make-instance 'class2 :keyword 100)
Keyword: 100
#<CLASS2 53202371>
------------------------------------------------------------
Any suggestions?
-Seth Goldstein
(message forwarded by W. Gillett)