[comp.lang.smalltalk] Which class/superclass implements a method ?

alp@ghp.UUCP (Al Parker) (08/03/90)

I am learning/evaluating/using Smalltalk V on a '386 and I have the
following question:

Given an instance for which a particular method is defined,
how can I determine which class or superclass implements the method ?
I realize I can do this by searching through the class hierarchy using
inspect or the class-browser but is there an easier way ?

Thanks in advance, Alp  |')
-- 
.-----------------------------------------------------------------------------.
| Al Parker, Senior Consultant with Gellman.Hayward & Partners Ltd            |
| 33 Yonge St., Toronto, Ontario, Canada, M5E 1G4        Voice: (416)862-0430 |
| UUCP:alp%ghp@mnetor.uucp                                                    |
`-----------------------------------------------------------------------------'

noodle@oak.circa.ufl.edu (08/04/90)

If I remember correctly, look in the Behavior class for methods which give
information about classes.  I wrote a program to generate a file which looks
just like the pages out of the Smalltalk\V manual so that I could look at
my objects the way they are presented in the manual.  I basically looked
at the code for the ClassHierarchyBrowser to see where they got all that info
about classes.  You might try that.

CHRIS_LAVENDER_WADE@cup.portal.com (08/06/90)

Evaluate the following:-
(assume the method name is dingle:)

Smalltalk implementorsOf: #dingle:

(note the # -- a symbol is required)

men408t@vaxc.cc.monash.edu.au (08/06/90)

Searching for who implements "dingle:" by
 Smalltalk implementorsOf: #dingle:
is fine if "dingle:" is not commonly implemented.
For a selector such as "at:" searching along a particular
branch of the Class Hierarchy might be more useful.

Ross Wilson
(in foreign territory - by consent of DJP)
MEN415M@vaxc.cc.monash.edu.au

MUHRTH@tubvm.cs.tu-berlin.de (Thomas Muhr) (08/06/90)

nnget
In article <32471@cup.portal.com>, CHRIS_LAVENDER_WADE@cup.portal.com says:
>
>Evaluate the following:-
>(assume the method name is dingle:)
>
>Smalltalk implementorsOf: #dingle:
>
>(note the # -- a symbol is required)
When I understood the original request correctly, it was the superclasses
which were wanted as a result. The abobe solution gives you the all methods
which bear the name of a message-symbol. Better try:
(classXY allSubclasses add: classXY;yourself) do:
  [:c| c methodDictionary keys includes: #selectorXYZ]
Result is an OrderedCollection of superclasses of classXY which respond to
'selectorXYZ'.
- Thomas