[Newbies] Re: Modify block (closure) parameters

psea denis.lukichev at gmail.com
Wed Aug 7 10:15:24 UTC 2013


Ok, i've got it. So in ST it's just not allowed assign to a block argument
for some reason. Let's consider it a language feature. And it's ok,
different language - different rules. Thanks for pointing me on that! 
Now, I've turn off allowBlockArgumentAssignment property. 

What's worried me is that in other languages I'm familiar with it's a normal
thing to assign to a function argument (Scheme, C, Python, JavaScript).

answer to your questions:
Smalltalk vmVersion 'Squeak3.10.2 of 11 February 2010 [latest update:
#9314]'
SmalltalkImage current systemInformationString "ditto" 'Squeak4.3
latest update: #11860
Current Change Set: Unnamed1'
Windows XP.

PS But you should agree with me that 

makeAcc := [ :acc |
        [:n | acc:=acc+n. acc]]

looks a little bit better and concise than

makeAcc := [ :acc |
        | total |
        total:=acc.
        [:n | total:=total+n. total]]

:-)

And thanks for the links.



--
View this message in context: http://forum.world.st/Modify-block-closure-parameters-tp4702118p4702410.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.


More information about the Beginners mailing list