Block Closure & fixTemps (was Squeak textbox and events)
Bert Freudenberg
bert at isg.cs.uni-magdeburg.de
Sun May 13 21:29:45 UTC 2001
On Sun, 13 May 2001, Noel J. Bergman wrote:
> Bert,
>
> So to "fix" Scott's example, this:
>
> x := [ :foo |
> |temp|
> temp := foo.
> [ temp ] ].
>
> y := x value: 12.
> z := x value: 13.
>
> would become this:
>
> x := [ :foo |
> |temp|
> temp := foo.
> [ temp ] fixtemps].
>
> y := x value: 12.
> z := x value: 13.
>
> resulting in "y value." -> 12 and "z value." -> 13, as desired.
>
> Correct?
Yes. You can even write
x := [ :foo | [ foo ] fixTemps ].
> Are you indicating that the Block Closure functionality is present,
> but at the expense of a source change, or is there another side-effect
> that I am missing between Block Closures and BlockContext>>fixTemps?
Squeak does not (yet) have Block Closures. The #fixTemps just creates
copies of all temps - which works fine only for read-only access. Try
this:
| a b c |
a := 2r101010. "whatever"
b := [ :foo | [ a := foo] fixTemps ].
c := b value: 12.
c value.
a "is 12 now, or is it?"
Hint: Douglas Adams is still right!
-- Bert
More information about the Squeak-dev
mailing list
|