[squeak-dev] Cannot store into-> (Is this related to changes in        Spur)?

gettimothy gettimothy at zoho.com
Wed Nov 10 14:22:33 UTC 2021


Hi Christoph



Thank you.



I too saw the uselessness of the attempted assignment and have removed them.



I agree also on the "style" issue as it makes my feeble brain ache less.



cordially,









---- On Wed, 10 Nov 2021 08:37:05 -0500 Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote ----



There is a preference for this: Scanner allowBlockArgumentAssignment which false by default. However, I would rarely consider this good style; usually, it's a better idea to declare a separate temp var to keep arguments immutable. But if I did not
 misread your example, you do not need the assignments anyway - the into: block of #inject:into: just needs to answer the next accumulated value, and you already do this even if you do not reassign the block argument variable.



Best,

Christoph





Von: Squeak-dev <mailto:squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von gettimothy via Squeak-dev <mailto:squeak-dev at lists.squeakfoundation.org>
 Gesendet: Dienstag, 9. November 2021 15:44:11
 An: squeak-dev
 Betreff: [squeak-dev] Cannot store into-> (Is this related to changes in Spur)? 
 


Hi Folks,



I am migrating a package from Cog to Spur and I am getting errors that I suspect are related to it.





Here is an example:





|result|

  result := pairs inject: first

                        into: [ :base  :pair |

                              (pair first = 'round')

                                    ifTrue: [

                                                (pair last >= 0)

                                                      ifTrue:[

                                                            (base >=0)

                                                                  ifTrue:["Cannot store into ->"base := base roundUpTo: ((1/10) raisedTo:(pair last truncated)) asFloat]

                                                                  ifFalse:[base := base roundDownTo: ((1/10) raisedTo:(pair last truncated)) asFloat]]

                                                      ifFalse:[

                                                            (base >=0)  

                                                                  ifTrue:[

                                                                              base := base roundDownTo: ((1/10) raisedTo:(pair last truncated)) asFloat]

                                                                                         ifFalse:[base := base roundUpTo: ((1/10) raisedTo:(pair last truncated)) asFloat]]]].



                                                                        transcripton ifTrue:[Transcript show:'PHPRoundSimple ' , (result asFloat); cr. ].



^ result





Is this related to changes in Spur?



thx



t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211110/1f828fbe/attachment.html>


More information about the Squeak-dev mailing list