[squeak-dev] #ensure: What would you expect?
Chris Cunnington
smalltalktelevision at gmail.com
Fri Dec 2 15:34:09 UTC 2011
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
More information about the Squeak-dev
mailing list
|