From: Robert Klemme Date: 2005-03-31T18:05:00+09:00 Subject: Re: Syntax sugar idea for loops "Lasse Koskela" schrieb im Newsbeitrag news:3975e2d105033023544bb28311@mail.gmail.com... > On Thu, 31 Mar 2005 16:34:44 +0900, Robert Klemme wrote: > > Yeah, "odd" and "even" are much too specific IMHO. Using the index is the > > most general solution. > > True, odd and even are rather specific but is that such a bad thing, > really? If the odd-even semantics are a common need, why not add > support for it in the language? Then I'd still prefer class Fixnum def odd?() self % 2 == 1 end def even?() self % 2 == 0 end end over an iteration specific thing. > I mean, why else would Ruby have > Array.each etc. instead of for (i=0; i < x; i++) which is clearly more > powerful in terms of all the things you can do with it? Yeah, true. But it's always balancing convenience vs. bloat: if you stick too much convenience functionality into a language / library then it'll be too bloated and there will be too many ways to do a single thing. I think that odd and even for iterations is not general enough and this not used too much. I may be wrong here though. Kind regards robert