On Thu, Jul 31, 2008 at 3:32 PM, askoh <askoh@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.