2009/12/25 Stéphane Ducasse <[email protected]>:
> Yes but when I load the fix
> the bug is still there.
> Did you slice changes this behavior?
> or the slice is just about adding a test that fails?
>
>
>
>> Yes, that's the bug, identified by Nicolas
>>
>> Alexandre
>>
>>
>> On 25 Dec 2009, at 10:49, Stéphane Ducasse wrote:
>>
>>> I tried to understand
>>>>
>>>>
>>>>
>>>> A very simple example to illustrate the bug:
>>>>
>>>> | x |
>>>> x := (1.0 timesTwoPower: 53).
>>>> (x to: x + 2) size.
>>>> x to: x+2 do: [:i | Transcript cr; show: i printString]
>>>
>>> it is normal that it still loops forever after loading the slice?
>

I thought it was already in Pharo, wasn't it ?
The fix only apply to this one (Interval>>do:):

(x to: x+2) do: [:i | self doSomethingWith: i]

not to this one (Number:>#to:do:):

x to: x+2 do: [:i | self doSomethingWith: i]

The second one is inlined by compiler as something like
i := x.
end := x+2.
[i <= end] whileTrue: [
   self doSomethingWith: i.
   i := i+1]

Converting to a (step*index+start) pattern would cost consumption of
additional temporary variable slots and complexified code for every
inlined #to:do: loop.
I did not find any satisfying solution yet, just to make silly loop on
Float work, so by now this remains a known limitation.
General rule: avoid using interval of Float. Don't use to:by:do: with
a Float receiver nor a Float step.

Nicolas

>
>
>
>>>
>>> Stef
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [email protected]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to