From: Hal Fulton Date: 2003-11-27T07:05:05+09:00 Subject: Re: Time#succ ? Paul Brannan wrote: > On Mon, Nov 24, 2003 at 05:36:49AM +0900, Hal Fulton wrote: > >>Should this be added? It would enable the creation >>of Time ranges like t1..t2 and so on. > > > Does this not already work? > > [pbrannan@zaphod ruby]$ irb > irb(main):001:0> t = Time.now > => Wed Nov 26 16:27:46 EST 2003 > irb(main):002:0> (t .. t+1) > => Wed Nov 26 16:27:46 EST 2003..Wed Nov 26 16:27:47 EST 2003 > > (the problem only comes if you want to iterate over the range, which > seems to me to be an ill-defined operation). Hmmm. For some reason I thought that to have a Range, the endpoint objects had to know #succ. Apparently Time ranges do work fine. I don't know why I never thought of them before. As for iterating: I agree it's ill-defined, but I think it's reasonable to let t.succ be the same as t+1 (since the latter is already meaningful). But since I can construct a Time range and call include? on it, I suppose that's all we really need. Hal