Everything Is an Object
An object encapsulates state (instance variables) and behavior (methods).
5.1 Objects and messages
An object encapsulates state (instance variables) and behavior (methods). You interact with it only by sending messages; the object decides how to respond by looking up a method in its class.
3 + 4. "send #+ with argument 4 to the object 3"
3 class. "→ SmallInteger"
3 class class. "→ SmallInteger class (a metaclass)"
nil class. "→ UndefinedObject"
true class. "→ True"
[ :x | x * 2 ] class. "→ FullBlockClosure (Pharo 9+), BlockClosure in older dialects"
(3 > 2) class. "→ True"
Object class. "→ Object class"
(Point >> #x) class. "→ CompiledMethod"5.2 Comments and evaluation
Comments are in double quotes ("a comment"), strings in single quotes ('a string'), statements are separated by periods, and every expression returns an object (Print it shows its printString).
5.3 Asking objects about themselves
42 respondsTo: #factorial. "→ true"
42 isKindOf: Integer. "→ true"
42 isMemberOf: Integer. "→ false (it is a SmallInteger)"
42 isNumber. 'abc' isString. "→ true true"
42 class allSuperclasses. "→ an OrderedCollection(Integer Number Magnitude Object ProtoObject)"5.4 Identity vs equality
= is equality (overridable), == is identity (same object; never override). ~= and ~~ are the negations.
'abc' = 'abc'. "→ true (equal contents)"
'abc' == 'abc'. "→ usually false (two different string objects)"
#abc == #abc. "→ true (symbols are unique)"
3 == 3. "→ true (SmallIntegers are immediate objects)"