5

Let's say I want to see how "copy" is implemented in the Dictionary class. Currently I use the system browser and manually traverse the inheritance hierarchy (bottom up) until I find the class that implements the given message. Is there a one-liner for the workspace, that would open the system browser at the right location?

Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196

4 Answers4

6
( SomeClass whichClassIncludesSelector: #initialize ) browse

That will browse the class that implements the message #initialize.

Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196
6

Personally, I just type the #selector in a workspace, highlight it, and hit alt+m to pull up all implementors of the message. Much faster than typing all that code.

Ramon Leon
  • 547
  • 2
  • 5
2

(SomeClass>>#someSelector) browse

works as well in my Pharo image.

works as well in my Pharo image. And since you want to find a class first, you can combine it with previous example..

((SomeSubclass whichClassIncludesSelector: #someSelector)>>#someSelector) browse

to directly go to given method.

Igor Stasenko
  • 1,037
  • 5
  • 8
2

If you are using OmniBrowser, you can use the contextual menu Implementors in Hierarchy... to only browse the implementors of a selector in the hierarchy of the Dictionary.

OmniBrowser also provides an Inheritance Browser. Select any implementation of #copy and click on the Inheritance button in the toolbar. It will show you a hierarchical view of all implementors of #copy.

Lukas Renggli
  • 8,754
  • 23
  • 46