My thinking process:
- a passes a block to b - b passes the block to c - it is sent #value and returns 1 - which is thrown away - the return value becomes 3 - that becomes the return value of the first block in #b: - a check is made to ensure 2 - what kind of test is ensure running? - [3] ensure: [2] - i'll say #ensure: is testing their is an object there - so the answer is 3
(spoilers) The actual answer:
turns out the answer is aFoo, so I guess all numbers were a ruse and it returned self.
Why, I couldn't say. I guess #ensure: has a property I don't understand.
Chris
On 02.12.2011, at 16:34, Chris Cunnington wrote:
Why, I couldn't say. I guess #ensure: has a property I don't understand.
Modify "a" to make clearer what's happening:
a self b: [^ 1]. ^ 13r6 * 13r9 radix: 13
(this changes the answer to a more appropriate value)
- Bert -
squeak-dev@lists.squeakfoundation.org