Hello --

On Wed, 3 Jul 2002, Nikodemus Siivola wrote:

> 2) Ranges as ranges of floats and integers:
>
>   Range.new(0...4) === 3.2 #-> true
>
> So, the current behaviour is correct, since iteration over a
> floating range should default to a step of one, but I should definable
> at creation:

I believe the step is defined more generally as anObject.succ, which
of course is +1 for integers but which can have very different
(non-numerical) meaning for other types.

>  Range.new(0...2, 0.5) === 1.3 #-> true
>  Range.new(0...2, 0.5).to_ary == [0.0, 0.5, 1.0, 1.5, 2.0]
>
> So a range object would case-match against any number between the two
> extremes, but would be iterated over at a definable step and use the same
> step in array / set conversion.

You're using a constructor as an argument to a constructor here....
Are you advocating a fourth argument to Range.new?  Although, again,
this seems to be specifically a way to construct numerical ranges,
without (to me) clear applicability to other ranges.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav