[squeak-dev] Re: Temporary Variables and Blocks
Bernd Elkemann
elkemann at web.de
Tue Jun 16 15:59:35 UTC 2009
Hi!
Agreed, real closures support is the way to go.
But if you already have an application integrated into your
older-version image you might want to try this workaround:
callbacks := OrderedCollection new.
(Array with: 1 with: 2 with: 3) do: [ :each | callbacks add: (Compiler
evaluate:'[ Transcript show: ',each asString,' asString ]') ].
callbacks do: [ :each | each value ]
Is this what you meant?
Greetings!
Anthony Kaufman schrieb:
> Hi, I've been programming smalltalk for a couple of years (VisualWorks
> for the most part) and recently ran into something I'm not quite sure
> what to do with:
>
> callbacks := OrderedCollection new.
> (Array with: 1 with: 2 with: 3) do: [ :each | callbacks add: [
> Transcript show: each asString ] ].
> callbacks do: [ :each | each value ]
>
> In Squeak, my transcript shows 333 while in VisualWorks, 123 which I
> would expect. What's going on here and is there anything I can do about
> it? I'm sure this question isn't a new one but I wasn't able to
> articulate my Google and mailing list searches in such a way that gave
> me an answer.
>
> Thanks,
> Anthony
>
>
More information about the Squeak-dev
mailing list
|