Newbie question.

Syver Enstad <[email protected]> 08 Dec 2002 05:43:36 +0100
Newsgroups gmane.emacs.eieio
Message-ID <[email protected]>
How do I call a method "dynamically".

To examplify:

I have a class

(defclass was-run ()
  ((name :initarg :name
         :initform nil))
)

(defmethod run ((self was-run))
  "Run the the method by name."
  ;; psudo code
  (apply name self))

(defmethod my-method((self was-run))
  (message "Called my-method"))

I want to pass f.ex. a string to the constructor so that the name slot
holds the method name.

When I run the following:

(setq instance (was-run "" :name "my-method"))
(run instance)

It should print "Called my-method".






-- 

Vennlig hilsen 

Syver Enstad




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