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

Apply fails with call-next-method



I am trying to write a specialized primary *initialize-instance method
(I am using the new *make-instance protocol) that will modify the
&rest init-plist before the inherited primary and after methods see
the init-plist.  I tried to achieve this with apply with the following
results:

; (LISP-IMPLEMENTATION-TYPE) = Allegro CL
; (LISP-IMPLEMENTATION-VERSION) = 3.0.1 [sun3] (8/16/88 17:44)
; (SOFTWARE-TYPE) = SMI Unix
; (MACHINE-TYPE) = Sun Microsystems
; PCL::*PCL-SYSTEM-DATE* = 8/28/88 (beta rev 1) AAAI PCL 

<cl> (in-package :foo :use '(:pcl :lisp))

#<The FOO package, 0 internal, 0 external> 
<cl> (defclass one () ((a :initform nil :initarg :a :accessor one-a)))

NIL

<cl> (defmethod pcl::*initialize-instance
       ((self one) &rest init-plist &key a &allow-other-keys)
       (apply 'call-next-method :a (if (null a) nil t) init-plist))

; of course in this simple example we could just drop the init-plist,
; however, in my system this is not the case.

NIL 
<cl> (pcl::*make-instance 'one :a 7)
Error: attempt to call `CALL-NEXT-METHOD' which is an undefined
function.

Restart actions (select using :continue):
 0: prompt for a new function, instead of `CALL-NEXT-METHOD'.
[1c] <cl> 

Should it be possible to use apply with the lexically defined
call-next-method?   Is there a better way to do this?

;rob

  Robert C. Pettengill, MCC Software Technology Program
  P. O. Box 200195, Austin, Texas  78720
  ARPA:  rcp@mcc.com            PHONE:  (512) 338-3533
  UUCP:  {ihnp4,seismo,harvard,gatech,pyramid}!ut-sally!im4u!milano!rcp