From: Christoph Rippel Date: 2001-01-08T08:52:24+09:00 Subject: [ruby-talk:8799] Re: Backward Range implementation > -----Original Message----- > From: David Alan Black [mailto:dblack@candle.superlink.net] > Sent: Sunday, January 07, 2001 02:00 PM > To: ruby-talk ML > Subject: [ruby-talk:8788] Re: Backward Range implementation > > > Hello -- > > On Sun, 7 Jan 2001, Kevin Smith wrote: > > > > > Here's what I came up with that seems to work. I > > didn't exhaustively test all the methods of > > Range, but I think I probably hit the ones that > > weren't working. Oh, I don't expect backward > > ranges to support exclusive mode (it seems > > unbalanced), so I didn't test that. > > > > Gotta love this language > > > > Kevin ... > Further thoughts/hacks/enhancements/whatever? > > > David There is probably some code out there which relies on the semantics that ``(0..-1).each do |i| whatever(i) end'' does nothing. It seem more prudent to introduce a separate ``each_down'' iterator defined whenever a method ``#pred'' is provided? On the other hand ``(7..0).each do |i| whatever(i) end'' looks certainly much nicer. Christoph