These should be informative:

http://www.mirandabanda.org/cogblog/2008/06/07/closures-part-i/
http://www.mirandabanda.org/cogblog/2008/07/22/closures-part-ii-the-bytecodes/
http://www.mirandabanda.org/cogblog/2008/07/24/closures-part-iii-the-compiler/


On Tue, Aug 6, 2013 at 2:14 PM, Louis LaBrunda <Lou@keystone-software.com> wrote:
Hi Guys,

FWIW, VA Smalltalk doesn't allow changing block arguments.

Lou

On Tue, 6 Aug 2013 13:42:33 -0700, Casey Ransberger
<casey.obrien.r@gmail.com> wrote:

>I didn't read your post clearly enough. Yep, that would seem odd. You may
>have a bug there. I'm not sure why that happens. It looks like the outer
>context isn't taking the assignment, but hanging onto the initial value it
>receives from #value:.
>
>I'm not totally sure we should expect to be able to do what you're trying
>to do in modern Squeak. I haven't assigned to a block arg in a long time (I
>keep allow block assignments off unless I'm loading old code.) I don't know
>what the status is there. I run a relatively recent Cog VM on a 10.7.5 Mac
>and I'm seeing the same behavior in Squeak 4.4.
>
>When I switch to an old VM (3.8.18Beta3U) and run Squeak 3.0, your snippet
>works as expected. I'm not sure if this is in the image or the VM yet, or
>whether it's expected behavior or not with allowBlockArgumentAssignment
>(Again, I usually turn it off.)
>
>The main take away here is, don't do that:) as it's a back-compat feature
>and it really ought to have a big sign on it that says DEPRECATED. If
>you're trying to load some older code and running into this, it might be
>better to actually rewrite it not to assign to block arguments in my
>opinion (and maybe I'm nuts.)
>
>Can you tell me what VM you're using?
>
>Smalltalk vmVersion "this will tell us"
>
>And also which version of Squeak?
>
>SmalltalkImage current systemInformationString "ditto"
>
>Also, what's the OS of the host system?
>
>
>
>On Mon, Aug 5, 2013 at 1:44 AM, psea <denis.lukichev@gmail.com> wrote:
>
>> Hi Smalltalkers!
>>
>> Here is a question I can't find answer with google.
>> In short: Does block parameters and block local variables are the same
>> thing
>> (semantically) inside closure? It looks like it's not. Below the
>> explanation.
>>
>> ===================
>> Here is the accumulator function (first attempt):
>>
>> makeAcc := [ :acc |
>>         [:n | acc:=acc+n. acc]]
>>
>> It turns out it doesn't work as intended:
>>
>> a1 := makeAcc value: 10
>> a1 value: 1 => 11
>> a1 value: 1 => 11
>> a1 value: 2 => 12
>>
>> ====================
>> Here is the second attempt:
>>
>> makeAcc := [ :acc |
>>         | total |
>>         total:=acc.
>>         [:n | total:=total+n. total]]
>>
>> And it does work as intended:
>>
>> a1 := makeAcc value: 10
>> a1 value: 1 => 11
>> a1 value: 1 => 12
>> a1 value: 2 => 14
>>
>> So if we use the local variable to store accumulator it works as it should
>> and remembers the value between function (block) calls. But if we use block
>> parameter to store the value of accumulator it does not remembers the value
>> between calls.
>> Why is it so?
>>
>> P.S. Sorry for my English. I do all my best.
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Modify-block-closure-parameters-tp4702118.html
>> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>> _______________________________________________
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



--
Casey Ransberger