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 |
Hi Anthony -
This issue is in the process of being fixed. If you fetch the latest VM from SqueakVM.org and use the following image it will work: http://squeakvm.org/win32/release/Squeak-3.10.2-Closures.zip This is a preview-image for closure support. Cheers, - Andreas Anthony Kaufman wrote: > 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 > > |
Great, thank you Andreas.
On Jun 15, 2009, at 3:49 PM, Andreas Raab wrote: > Hi Anthony - > > This issue is in the process of being fixed. If you fetch the latest > VM from SqueakVM.org and use the following image it will work: > > http://squeakvm.org/win32/release/Squeak-3.10.2-Closures.zip > > This is a preview-image for closure support. > > Cheers, > - Andreas > > Anthony Kaufman wrote: >> 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 > > |
In reply to this post by Anthony Kaufman
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 > > |
Free forum by Nabble | Edit this page |