From: Robert Klemme Date: 2005-01-14T18:51:12+09:00 Subject: Re: request for times, step, upto... "Pe単a, Botp" schrieb im Newsbeitrag news:20050114070636.2F2EB83F5@mx2.delmonte-phil.com... > Hi, > > 1. I am a Integer#times fan :-) So you see my (and my kids) nuby codes > littered w it. I have a small request though. > Can we pass initial and step params? > > ie > > from int.times {|i| block } > > to int.times(starting=0, step=1) {|i| block } > > I hope this would not break old code, right? Sure, but semantics of this method will be broken. The block will no longer execute int times. We have #step for that as know. > 2. my request may be handled by step. But I do not like step (me only); > maybe because the sound does not ring or maybe because I do not like the > order of params when read. Ah, so you *do* care about the correlation between semantics and method names. > iow > > from num.step(limit, step ) {|i| block }, > > I prefer fr_num.step(step, upto ) {|i| block } > > since I would read the ff 1.step(2,5) {|x| p x} as > "from 1 step 2 up to 5" (I know this would break old code) > > I feel Integer#upto has a better read -"int.upto(limit) {|i| block }", but > sadly #upto has no steps either :( That could be added. And it would be a resonable and good change IMHO. Same for #downto btw. > thanks for reading =) Thanks for calling. :-) Kind regards robert