Hi
It seems that we can't call a static method on an object, instead of
on a class. For example:
(defclass A ()
())
(defmethod F :STATIC ((class A))
(message "F A"))
(F A)
(F (A nil))
The first call works, but not the second one, which results in the
following error:
no-method-definition F "#<A nil>"
Here is the patch I use for a long time:
*** eieio.el-orig Fri Jul 30 19:59:54 2004
--- eieio.el Mon Mar 7 14:36:14 2005
***************
*** 1533,1546 ****
;; 2) Only call static if this is a static method.
;; 3) Only call specifics if the definition allows for them.
;; 4) Call in order based on :BEFORE, :PRIMARY, and :AFTER
! (if static
! (progn
! (setq tlambdas
! (eieio-generic-form method method-static mclass))
! (setq lambdas (cons tlambdas lambdas)
! keys (cons method-static keys))
! )
!
;; Non-static calls do all this stuff.
(setq tlambdas
(or (and mclass (eieio-generic-form method method-after mclass))
--- 1533,1539 ----
;; 2) Only call static if this is a static method.
;; 3) Only call specifics if the definition allows for them.
;; 4) Call in order based on :BEFORE, :PRIMARY, and :AFTER
! (when (object-p firstarg)
;; Non-static calls do all this stuff.
(setq tlambdas
(or (and mclass (eieio-generic-form method method-after mclass))
***************
*** 1560,1565 ****
--- 1553,1564 ----
(setq lambdas (cons tlambdas lambdas)
keys (cons method-before keys))
)
+ (unless (find-if (lambda (x) x) lambdas)
+ (setq tlambdas
+ (eieio-generic-form method method-static mclass))
+ (setq lambdas (cons tlambdas lambdas)
+ keys (cons method-static keys))
+ )
;; Now loop through all occurances forms which we must execute
;; (which are happilly sorted now) and execute them all!
(let ((rval nil) (found nil))
--drkm
|