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

dispatching methods on a class type

>Date: Thu, 1 Oct 92 23:06:30 -0400
>From: taarna!kaveh%comback.UUCP@IRO.UMontreal.CA (Kaveh Kardan)
>To: info-mcl@cambridge.apple.com
>Subject: dispatching methods on a class type
>I am wondering if there is a way in clos of dispatching methods on a class
>itself, as opposed to instances of the class.
>Here's the scenario:
>I have a complex hierarchical data structure, and would like to be able to
>extract all elements of a given class from it.  I have a method for each
>class which goes through the data structure and returns a list of the found
>instances of the class.  When I want a list off all instances of class
>'foo', I can't just call the method for foo, since I have no instances of
>foo handy.

This might come in handy:

 (class-prototype (find-class 'foo))

or maybe something along these lines:

 (defmethod munge ((class (eql (find-class 'bim))))

 (defmethod munge ((class (eql (find-class 'bam))))

 (defmethod munge ((class (eql (find-class 'boom))))