thanks clement! Could you also have a look at the suggestions henrik mentioned? Stef On 1/8/14 16:43, Clément Bera wrote:
Hello,
Nice way to reproduce easily the SmallInteger bug :)
| state values | values := (1 to: 100000) collect: [ :t | state := { t . t + 1 . t + 2 }]. values select: [ :e | e isInteger ]
This bug was present in some VMs and it is fixed in the latest VMs.
The stable Mac VM still have the bug.
If you need a VM without the bug, go there:
http://files.pharo.org/vm/pharo/30/
Click on your OS, then select the zip file named 'latest.zip' and download it.
The latest VM does not have the bug.
2014-08-01 15:20 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com <mailto:serge.stinckwich@gmail.com>>:
Dear all,
using Sci-Smalltalk, we found with Natalia that sometimes blocks have strange behavior : https://groups.google.com/forum/#!topic/scismalltalk/HmGpTkzLOdQ <https://groups.google.com/forum/#%21topic/scismalltalk/HmGpTkzLOdQ>
I was able to create a more simpler example using only Pharo. If you try, the following expression, there is no problem:
|state values | values := (1 to: 10000) collect: [ : t| state := { t. t+1. t+2.}]. (1 to: 10000) do:[:i | (values at:i) at:2].
and you do more iterations, an error appears (Instances of SmallInteger are not indexable), because from time to time, an array is replaced by an integer:
|state values | values := (1 to: 100000) collect: [ : t| state := { t. t+1. t+2.}]. (1 to: 100000) do:[:i | (values at:i) at:2].
and if you move the state variable inside the block, it works again :
| values | values := (1 to: 100000) collect: [ : t| |state| state := { t. t+1. t+2.}]. (1 to: 100000) do:[:i | (values at:i) at:2].
Same problem in Pharo 3.0 or Pharo 4.0
Regards, -- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/