Bug Involving Modified #to:by:do:

Tim Olson tim at jumpnet.com
Sun Jan 31 02:13:27 UTC 1999


>I also need to change "something" to handle my implementation of
>ScaledDecimal step or by parameters.  The following snippet shows an example
>of the odd results currently produced:
>
>        | x | x := OrderedCollection new.
>        (1/2) to: 5.5s2 by: 2.0 do: [ :n | x add: n]. ^x asArray
>                "-> ((1/2) + 2.5 4.5 )"
>
>The Interval elements should all be Float as the default conversion of
>Fraction operation Float is Float.

I'm not sure why you say they should all be Float.  The starting value of 
the to:by:do: is the initial value.  No operation is performed upon it, 
so there is no chance for it to be converted to some other Number class.

>Is there some reason that nextValue should be set before checking for the
>error?  Will I step on something if I swap it and check for the error before
>setting nextValue?

Nope; I just did so because it moved all the tests together. 



     -- tim





More information about the Squeak-dev mailing list