Re: Newbie question.

Syver Enstad <[email protected]> 08 Dec 2002 08:22:55 +0100
Newsgroups gmane.emacs.eieio
Message-ID <[email protected]>
Syver Enstad <[email protected]> writes:

> How do I call a method "dynamically".

I found out myself, here's how I did it:

(defclass test-case ()
  ((name :initarg :name
	 :type function))
)
(defmethod run ((self test-case))
  (setup self)
  (funcall (slot-value self 'name) self))

(defmethod setup ((self test-case))
  (message "base called with %s" self)
  )

(defmethod a-method ((self test-case))
  (message "%s a-method" self))

(run (test-case "" name: 'a-method))


-- 

Vennlig hilsen 

Syver Enstad




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf