From: Robert Dober Date: 2007-02-20T04:15:50+09:00 Subject: Re: The peak of the iceberg, was Range cannot loop down and RCR Integer#pred On 2/19/07, Daniel Schierbeck wrote: > On Mon, 2007-02-19 at 18:14 +0900, Robert Dober wrote: > > Hi all > > > > I was just following the thread about "loop cannot count down" and > > was about to propose a monkey patched method which might have been > > convenient for the poster. > > > > Like e.g. Range#each_down (bad name I know). > > > > The point is, I cannot, because Range#each is based on succ, and > > Range#each_down would be based on pred. > > > > I just wonder if it might not be a good idea to define pred for all > > core classes for which succ is defined. I kind of feel stupid not > > having suggested that in the first place, now :(. > > (http://rcrchive.net/rcrs/6) > > > > Opinions? > > It seems you beat me to it :) Really my fault, I did not discuss it on the list, I did announce it though, because it seemed so simple. AAMOF Matz accepted it surely because of its simplicity. Really a mistake of mine because it could have been discussed for many more classes and its impact on Ranges. Maybe you would like to lead discussion about this one, as I stole the other one from you ;) ? > > I'm sure it's been brought up before, and it will surely add more > complexity But I do not advocate any usage of #pred, I just advocate its presence. The user has the power than :) >to a problem that seems relatively small, I am not really sure it is that small, this unidirectionality seems somehow incorrect to me and what I said in the beginning really bothers me I cannot iterate through a Range in the reverse sense. > based on the low > volume of posts on it here on the mailing list. It is not an issue for most of us I did not run into it in two years of Ruby Programming but now that it was brought up for me an iceberg emerged. ;) > > > Cheers, > Daniel > Robert -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous