Appendix A
Frequently Asked Questions

A.1 Getting started

FAQ 1 Where do I get the latest Pharo?

Answer  http://www.pharo-project.org/
FAQ 2 Which Pharo image should I use with this book?
Answer  You should be able to use any Pharo image, but we recommend you to use the prepared image on the Pharo by Example web site: http://PharoByExample.org. You should also be able to use most other images, but you may find that the hands-on exercises behave differently in surprising ways.

A.2 Collections

FAQ 3 How do I sort an OrderedCollection?

Answer  Send it the message asSortedCollection.
 
#(7 2 6 1) asSortedCollection -→ a SortedCollection(1 2 6 7)  

FAQ 4 How do I convert a collection of characters to a String?

Answer  
 
String streamContents: [:str | str nextPutAll: hello asSet] -→ hleo  

A.3 Browsing the system

FAQ 5 The browser does not look like the one described in the book. What gives?

Answer  You are probably using an image in which a different version of the OmniBrowser is installed as the default browser. In this book we assume that the OmniBrowser Package Browser is installed as the default. You can change the default by clicking on the menu bar of the browser. Just click on the gray lozenge in the top right corner of the window, select “Choose new default Browser”, and then pick the O2PackageBrowserAdaptor. The next browser you open will be the Package Browser.
PIC
(a) Choose a new browser
PIC
(b) Select the OB Package Browser

Figure A.1: Changing the default browser

FAQ 6 How do I search for a class?
Answer  CMD–b (browse) on the class name, or CMD–f in the category pane of the browser.
FAQ 7 How do I find/browse all sends to super?
Answer  The second solution is much faster:
 
SystemNavigation default browseMethodsWithSourceString: super. 
SystemNavigation default browseAllSelect: [:method | method sendsToSuper ].  

FAQ 8 How do I browse all super sends within a hierarchy?

Answer  
 
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.  

FAQ 9 How do I find out which new methods are introduced by a class? (I.e., not including overridden methods.)

Answer  Here we ask which methods are introduced by True:
 
newMethods := [:aClass| aClass methodDict keys select: 
    [:aMethod | (aClass superclass canUnderstand: aMethod) not ]]. 
newMethods value: True -→ an IdentitySet(#asBit #xor:)  

FAQ 10 How do I tell which methods of a class are abstract?

Answer  
 
abstractMethods := 
    [:aClass | aClass methodDict keys select: 
        [:aMethod | (aClass>>aMethod) isAbstract ]]. 
abstractMethods value: Collection -→ an IdentitySet(#remove:ifAbsent: #add: #do:)  

FAQ 11 How do I generate a view of the AST of an expression?

Answer  Load AST from squeaksource.com. Then evaluate:
 
(RBParser parseExpression: 3+4) explore  
(Alternatively explore it.)

FAQ 12 How do I find all the Traits in the system?

Answer  
 
Smalltalk allTraits  

FAQ 13 How do I find which classes use traits?

Answer  
 
Smalltalk allClasses select: [:each | each hasTraitComposition and: [each traitComposition notEmpty ]]  

A.4 Using Monticello and SqueakSource

FAQ 14 How do I load a SqueakSource project?

Answer  
1.
Find the project you want in http://squeaksource.com
2.
Copy the registration code snippet
3.
Select open Monticello browser
4.
Select +Repository HTTP
5.
Paste and accept the Registration code snippet; enter your password
6.
Select the new repository and Open it
7.
Select and load the latest version

FAQ 15 How do I create a SqueakSource project?

Answer  
1.
Go to http://squeaksource.com
2.
Register yourself as a new member
3.
Register a project (name = category)
4.
Copy the Registration code snippet
5.
open Monticello browser
6.
+Package to add the category
7.
Select the package
8.
+Repository HTTP
9.
Paste and accept the Registration code snippet; enter your password
10.
Save to save the first version

FAQ 16 How do I extend Number with Numberchf but have Monticello recognize it as being part of my Money project?

Answer  Put it in a method-category named *Money. Monticello gathers all methods that are in other categories named like *package and include browm in s="pplr">Cop4r5"i023r55073-266048r548">

Answ.4

FAQ 7 explof the

Answer notEmpty Money
FAQ 8 defai8t-">Hte a view of the
Answer �̶Refa-x-x8t-"E"cone00A0;Load AST from squ: mitem">Go to Go to
FAQ 9 Answer Pacorner s="pplr">Cop4r5"8 i7r55="x73-266005r1"> 8r548">

Answ.4 AST of slike vr8tt-x-xqueakSource

FAQ 10 is instaocdd ntt the do e and aExbrowm inan expression?

Answer Save RBParser Open HTTP
FAQ 11 itx-xses use traits?
Answer Go to Go to
FAQ 12 H0A0;Lo I create a SmaccDevelopd nt oollo recognize itx-xses use traits?
Answer Select and load the ltrign the b8t-ewtheoer:

ross clklass!--l. 157-->

[mitem">Go PBE1ch15.htmlea>>ASvdx73] [mitem">Go PBE1ch15.html#tailPBE1ch15.htmlea>>ASv-taildx73] [mitem">Go PBE1ap1.htmlea>0A0ntdx73] [mitem">Go PBE1.html# ea>updx73]

m? n the