The browser does not look like the one described in the book. What gives?
You are probably using an image in which the OmniBrowser is installed as the default System browser. You can change the default by clicking on the little menu icon in the top-left corner of the browser window, between the “X” and the browser label, and selecting “Choose new default browser” from the menu that appears. Select
#Browser to get the plain old browser. (This preference changes the effect of the
World ⊳ open . . . ⊳ system browser menu, but not what happens when you drag the
Browser icon from the
How do I search for a class?
CMD–b (browse) on the class name, or CMD–f in the category pane of the class browser.
How do I find/browse all sends to super?
The second solution is much faster:
SystemNavigation default browseMethodsWithSourceString: 'super'. SystemNavigation default browseAllSelect: [:method | method sendsToSuper ].
How do I browse all super sends within a hierarchy?
browseSuperSends := [:aClass | SystemNavigation default browseMessageList: (aClass withAllSubclasses gather: [ :each | (each methodDict associations select: [ :assoc | assoc value sendsToSuper ]) collect: [ :assoc | MethodReference class: each selector: assoc key ] ]) name: 'Supersends of ' , aClass name , ' and its subclasses']. browseSuperSends value: OrderedCollection.
How do I find out which new methods are introduced by a class? (I.e., not including overridden methods.)
Here we ask which methods are introduced by
newMethods := [:aClass| aClass methodDict keys select: [:aMethod | (aClass superclass canUnderstand: aMethod) not ]]. newMethods value: True −→ an IdentitySet(#asBit)
How do I tell which methods of a class are abstract?
abstractMethods := [:aClass | aClass methodDict keys select: [:aMethod | (aClass>>aMethod) isAbstract ]]. abstractMethods value: Collection −→ an IdentitySet(#remove:ifAbsent: #add: #do:)
How do I generate a view of the AST of an expression?
Load AST from squeaksource.com. Then evaluate:
(RBParser parseExpression: '3+4') explore
(Alternatively explore it.)
How do I find all the Traits in the system?
How do I find which classes use traits?
Smalltalk allClasses select: [:each | each hasTraitComposition and: [each traitComposition notEmpty ]]