Very odd Closure bug?
Tim Olson
tim at jumpnet.com
Thu Apr 6 13:21:18 UTC 2000
Henrik wrote:
>I got a very weird bug:
>
>after having done
>
> wrappedArguments _ (arguments collect: [:argNode | [argNode]]) asArray.
>
>--this evaluates to the last argNode for both elements of the resulting
>array.
>
>I suspect that this is "as should be" given the present state of the closure
>implementation...
Yes, this is the expected result. The current scoping for block
variables is the same as method temporaries, so each of the blocks in the
collection have a reference to the same argNode variable.
-- tim
More information about the Squeak-dev
mailing list
|