List Info

Thread: Re: Recent changes in Range#step behavior




Re: Recent changes in Range#step behavior
user name
2008-03-26 10:59:25
Hi,

In message "Re: Recent changes in Range#step
behavior"
    on Wed, 26 Mar 2008 23:50:56 +0900, "Vladimir
Sizikov" <vsizikovgmail.com> writes:

|The bug question is whether this new behavior (when the
step argument
|is converted to  integer) is intentional.
|
|It's incompatible with MRI 1.8.6 patchlevel 111 behavior,
it produces
|confusing exceptions and it silently looses precision. And,
it fails
|"the rubyspecs", Charlie was mentioning earlier
in this thread.
|
|Anyone from core team to clarify? There is some activity in
JRuby to
|update the Range#step behavior and we'd like to know which
way to go.

I think 1.8 should not change its behavior, so p111 step
behavior
should be reverted.

The rest should be discussed.  I had a reason for the
behavior, but
I now feel that Range#step should be compatible with
Numeric#step if
the edge values are numeric.

							matz.


Re: Recent changes in Range#step behavior
user name
2008-03-26 11:22:43
On Mar 26, 2008, at 10:59 AM, Yukihiro Matsumoto wrote:
> The rest should be discussed.  I had a reason for the
behavior, but
> I now feel that Range#step should be compatible with
Numeric#step if
> the edge values are numeric.

Can we reopen the member? discussion too? I honestly feel
that the  
name implies set membership, so

(1..3).member?(2.5)

should, I believe, be false, as 1..3 is the set of integers
from 1 to 3.


Dave


Re: Recent changes in Range#step behavior
user name
2008-03-26 12:04:57
HI,

On Wed, Mar 26, 2008 at 4:59 PM, Yukihiro Matsumoto
<matzruby-lang.org> wrote:
>  |Anyone from core team to clarify? There is some
activity in JRuby to
>  |update the Range#step behavior and we'd like to know
which way to go.
>
>  I think 1.8 should not change its behavior, so p111
step behavior
>  should be reverted.

Most excellent, so the MRI 1.8.6 behavior should be the same
as in
patchlevel 111, our "golden compatibility target"
for the moment,
that's what we needed to know for now. And that's what
"rubyspecs"
enforce for now.

>  The rest should be discussed.  I had a reason for the
behavior, but
>  I now feel that Range#step should be compatible with
Numeric#step if
>  the edge values are numeric.

Interesting, so this approach is from
"incrementing" point of view,
while the curent docs for both 1.8.6 and 1.9 (and in Dave's
book) are
from iterating point of view.

What about negative step values? Numeric#step allows them,
but for
Range that would be a very new behavior.

Thanks,
  --Vladimir


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )