This exercise is about reading and understanding Pharo expressions, and differentiating between different
types of messages and receivers.
Note that in the expressions you will be asked to read and executed, you
can assume that the implementation of methods generally corresponds to what their message names imply (i.e., 2 + 2 = 4).
In addition, most of the expressions we use in the exercises are expressions that you can execute in Pharo, so do not hesitate.
32.0.1. Exercise: Literal objects
What kind of object does the following literal expressions refer to?
32.0.1.1. Exercise:
Solution.
32.0.1.2. Exercise:
Solution.
32.0.1.3. Exercise:
Solution.
32.0.1.4. Exercise:
Solution.
32.0.1.5. Exercise:
Solution.
32.0.1.6. Exercise:
Solution.
32.0.1.7. Exercise:
Solution.
32.0.1.8. Exercise:
Solution.
32.1. Exercise: Messages
For each of the expressions below, fill in the answers:
What is the receiver object?
What is the message selector?
What is/are the argument (s)?
What is the result returned by this expression execution?
32.1.0.1. Exercise:
Solution.
32.1.0.2. Exercise:
Solution.
32.1.0.3. Exercise:
Solution.
32.1.0.4. Exercise:
Solution.
32.1.0.5. Exercise:
Solution.
32.1.0.6. Exercise:
Solution.
32.1.0.7. Exercise:
Solution.
32.1.0.8. Exercise:
Solution.
32.1.0.9. Exercise:
Solution.
32.1.0.10. Exercise:
Solution.
32.1.1. Exercise: Scope
32.1.1.1. Exercise:
What can one assume about a variable named Transferator?
Transferator is a global variable: either a class, a global variable or a class variable.
Solution.
32.1.1.2. Exercise:
What can one assume about a variable named rectangle?
Solution.rectangle is a local variable: either a temporary, an instance variable, or a method argument.