[squeak-dev] Serious bug in 3.10

Eliot Miranda eliot.miranda at gmail.com
Thu Jul 31 23:49:35 UTC 2008


On Thu, Jul 31, 2008 at 3:32 PM, askoh <askoh at askoh.com> wrote:

>
> | 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?


yes, but its ancient.  It is to do with the implementation of blocks and
specifically block temporaries.  Both blocks bind to the same "i".  So when
you evaluate
    block value: i + 1
the 1 to: do:'s i gets incremented.

Try this with my closure implementation (
http://www.mirandabanda.org/cogblog/downloads/) and it is fixed.

Aik-Siong Koh
> --
> View this message in context:
> http://www.nabble.com/Serious-bug-in-3.10-tp18764850p18764850.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080731/8a55d276/attachment.htm


More information about the Squeak-dev mailing list