Any reason for assigning block parameter in inject:into:

stephane ducasse stephane.ducasse at free.fr
Sat Apr 28 19:55:27 UTC 2007


I think that for imageSegment this is normal since you do not want to  
get reference
via the block arg (that are represented as local of the method  
containing the block).
For all the rest I would clean the code.

On 28 avr. 07, at 10:37, Lukas Renggli wrote:

>> asPacked
>>         ^ self
>>                 inject: 0
>>                 into: [:t1 :t2 | t1 := t1 * 256 + t2 asInteger]
>>
>> The assignment is not needed since the semantics of into: is to do
>> that exactly
>
> Odd that the compiler allows you to do that. In VW this code raises a
> compiler error, as it does in Squeak when you try to store into a
> method argument. I hope the new compiler is a bit more consistent.
>
> Cheers,
> Lukas
>
> -- 
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>




More information about the Squeak-dev mailing list