[bug][fix] range of single value gets divide-by-zero exception

Brian Rice water at tunes.org
Fri Nov 12 17:37:21 PST 2004


Thanks. It's applied to CVS now.

On Nov 12, 2004, at 5:04 PM, Tim Olson wrote:

> (1 to: 1).
>
> returns a divide by zero exception because the code to set the 
> appropriate increment value uses the <=> message, which returns 0 when 
> its operands are equal.  The fix is to explicitly use 1 or -1:
>
> r@(Range traits) newFrom: start to: end
> "This method implicitly defines a sensible default stepping value."
> [
>   r newFrom: start to: end by: (start <= end ifTrue: [1] ifFalse: [-1])
> ].
>
>
> 	-- Tim Olson
>
>
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list