Two ensure: questions
Andres Valloud
sqrmax at prodigy.net
Mon Apr 22 20:52:52 UTC 2002
Hello.
Let's say you evaluate this in a workspace.
[^self] ensure: [x := 1]
The ANSI spec says that ensure: should evaluate the receiver and,
immediately after evaluation but before returning its result, the
terminator block should be evaluated. But the block is ^self: how do
you evaluate without returning? Actually, the block doesn't even
"return" a value, it just caret-returns from it's method context. The
text from the ANSI spec is not conclusive in this matter.
Should x be 1 or nil? And if x should be 1, how do you implement
ensure: in Smalltalk so that you can figure out a block is
caret-returning on you?
Andres.
More information about the Squeak-dev
mailing list
|