[#15707] Schedule for the 1.8.7 release — "Akinori MUSHA" <knu@...>

Hi, developers,

21 messages 2008/03/01

[#15740] Copy-on-write friendly garbage collector — Hongli Lai <hongli@...99.net>

Hi.

31 messages 2008/03/03
[#15742] Re: Copy-on-write friendly garbage collector — Yukihiro Matsumoto <matz@...> 2008/03/03

Hi,

[#15829] Re: Copy-on-write friendly garbage collector — Daniel DeLorme <dan-ml@...42.com> 2008/03/08

Yukihiro Matsumoto wrote:

[#15756] embedding Ruby 1.9.0 inside pthread — "Suraj Kurapati" <sunaku@...>

Hello,

18 messages 2008/03/03
[#15759] Re: embedding Ruby 1.9.0 inside pthread — Nobuyoshi Nakada <nobu@...> 2008/03/04

Hi,

[#15760] Re: embedding Ruby 1.9.0 inside pthread — Yukihiro Matsumoto <matz@...> 2008/03/04

Hi,

[#15762] Re: embedding Ruby 1.9.0 inside pthread — "Suraj N. Kurapati" <sunaku@...> 2008/03/04

Yukihiro Matsumoto wrote:

[#15783] Adding startup and shutdown to Test::Unit — Daniel Berger <Daniel.Berger@...>

Hi all,

15 messages 2008/03/04

[#15835] TimeoutError in core, timeouts for ConditionVariable#wait — MenTaLguY <mental@...>

I've been reworking JRuby's stdlib to improve performance and fix

10 messages 2008/03/09

[#15990] Recent changes in Range#step behavior — "Vladimir Sizikov" <vsizikov@...>

Hi,

35 messages 2008/03/23
[#15991] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/23

[#15993] Re: Recent changes in Range#step behavior — "Vladimir Sizikov" <vsizikov@...> 2008/03/23

Hi Dave,

[#15997] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/23

[#16024] Re: Recent changes in Range#step behavior — "Vladimir Sizikov" <vsizikov@...> 2008/03/26

Hi Dave,

[#16025] Re: Recent changes in Range#step behavior — Yukihiro Matsumoto <matz@...> 2008/03/26

Hi,

[#16026] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/26

[#16027] Re: Recent changes in Range#step behavior — Yukihiro Matsumoto <matz@...> 2008/03/26

Hi,

[#16029] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/26

[#16030] Re: Recent changes in Range#step behavior — Yukihiro Matsumoto <matz@...> 2008/03/26

Hi,

[#16031] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/26

[#16032] Re: Recent changes in Range#step behavior — "Vladimir Sizikov" <vsizikov@...> 2008/03/26

On Wed, Mar 26, 2008 at 7:01 PM, Dave Thomas <dave@pragprog.com> wrote:

[#16033] Re: Recent changes in Range#step behavior — Dave Thomas <dave@...> 2008/03/26

[#16041] Re: Recent changes in Range#step behavior — David Flanagan <david@...> 2008/03/26

Dave Thomas wrote:

Re: Recent changes in Range#step behavior

From: David Flanagan <david@...>
Date: 2008-03-26 20:48:34 UTC
List: ruby-core #16041
Dave Thomas wrote:
> 
> On Mar 26, 2008, at 1:15 PM, Vladimir Sizikov wrote:
>>
>> Oh, btw, not only floats but also Rationals (and maybe some other
>> custom Numeric types).
>>
>> And such changes would invalidate the "The Ruby programming language"
>> book, section "Ranges":
>>
>> " If the endpoints of the range are numbers, these methods use the
>> continuous membership test, just as they did in Ruby 1.8. If the
>> endpoints are not numeric, however, they instead use the discrete
>> membership test. "
> 
> I'm updating that constantly as things change--that's the joy (and pain) 
> of the beta process... :)
> 

Hey Dave! Vladimir was quoting my book, not yours!  :-)

Thanks for noting the book compatibility issue, Vladimir.

I have several comments on this topic:

0) I assume that Matz had well-thought-out reasons for implementing the 
current behavior and that these are based on real-world utility.

1) I don't think it is worth breaking compatibility with 1.8 over this 
issue.  And I think changing include? and member? would break a 
substantial amount of code.

2) I don't believe it is correct to regard Ranges as sets of values. 
They are something different and can have continuous or discrete 
behavior depending on how they are used.  If you define a range as a 
kind of set, then the behavior of include? and member? seems wrong.  But 
  if you instead look at how those methods behave in 1.8 and 1.9 then it 
becomes clear that a range is not a set.

3) For ranges with integer endpoints, using succ is not a reasonable way 
to implement member? and include?--it is too slow compared to <=>. 
Therefore a discrete membership test is likely to involve some kind of 
type checking--to ensure that the argument is of the same class as the 
endpoints.  And I suspect that this might make some people uncomfortable.

4) I'd suggest that include? and member? be left as they are with their 
complex (sometimes discrete sometimes continuous) but 
backward-compatible behavior.  Ruby 1.9 already introduces a new method 
cover? that guarantees a continuous membership test.  Let's add yet 
another new method that guarantees a discrete membership test.  This new 
method could be called has?.  If cover? and has? prove satisfactory for 
Ruby 1.9 developers, then include? and member? could possibly be 
deprecated in 2.0.

	David

In This Thread