"Joe Mason" <joe / notcharles.ca> schrieb im Newsbeitrag news:slrnc0v1ru.pg0.joe / gate.notcharles.ca... > In article <20040121155809.22006.00000323 / mb-m22.aol.com>, GGarramuno wrote: > > > > for i in (0..i); something; end > > > > to me has a bunch of advantages over times, step and the such. With the above > > construct you know that: > > a) i has to be a number > > b) i has to be positive for the loop to run > > c) there IS a loop after all, as 'for' indicates a loop in pretty much every > > computer language. > > d) it is more efficient as no blocks are created. > > e) you can change the starting point (ie. not start at 0). > > > > > > With i.times() I really don't get any of the above. One can asume that i.times > > means a loop as it is perhaps a common construct in ruby. > > But the truth is that i.times() also leaves room for that behavior to not be > > true. It could mean something else, too. It could be a fancy benchmarking > > object measuring the following block. Or any object with a times() method, for > > that matter. > > Pre-assuming it is a loop to me is not as obvious as with a for loop. > > And you always get the performance hit of opening a block, which is a big no-no > > to me when speed matters. > > So, what you're saying is, you don't want to use Ruby's features because > the same names could be used in other ways. Even more: GGarramuno seems to suggest that a keyword or a name implies a certain semantics while this connection is purely conventional. Sure, many programming languages use "for" for looping, but this is nevertheless a convention and thus must be learned. The meaning of "times" can be learned the same way and the mnemonic isn't really that bad, is it? > That's a fair reason to not use Ruby, I suppose. Feel free not to. But > you're not going to convince anyone else with that argument. Definitely not. robert