[squeak-dev] Serious bug in 3.10

Ramon Leon ramon.leon at allresnet.com
Thu Jul 31 22:44:07 UTC 2008


> Sent: Thursday, July 31, 2008 3:33 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: [squeak-dev] Serious bug in 3.10
> 
> 
> | block |
> block := [:i | Transcript cr; show: i].
> 1 to: 10 do: [:i | block value: i+1]
> 
> The above should print ten times. But it only prints the five 
> even numbers.
> That is a bug isn't it?
> 
> Aik-Siong Koh

Try this..

block := [:f | Transcript cr; show: f].
(1 to: 10) do: [:f | block value: f+1]

And you'll see that likely, to:do: is being inlined by the compiler and
causing something funny like allowing you to increment the loops index var
causing it to skip a number each iteration.

Ramon Leon
http://onsmalltalk.com




More information about the Squeak-dev mailing list