From: Michael campbell Date: 2004-02-01T07:10:25+09:00 Subject: Re: Save the flip/flop op! Hal Fulton wrote: > Well, it runs counter to the rest of Ruby. I have no stance to debate that, but I'd wager that for virtually every construct in ruby 1 person considers within "the ruby way", there would be a set of people who disagree. > Since x..y is a range, and never evaluates to false or nil, I would > expect it always to be true. That I can concede as an inconsistency. >> Every solution presented thus far assumes I want to use it only for >> processing text files line by line, when in reality, I might need it >> for many other things, totally unrelated to that. > > > That may be. (My solution of course was extremely half-baked.) In that > case, I'd suggest a class for that purpose. A class as general-purpose > as possible. I'm open to that. As I said, so far, the people who have disliked the operator have only provided solutions to the stated examples of its use, not a general solution replacement. > I didn't mean it was ugly and obtuse because it came from Perl. Many > Perlism are easy to grasp. I'd be lost without =~ and regex literals. *chuckle* I realized what you were saying...about 30 minutes too late so apologies there. That said however, how many weeks on ruby-talk do you see pass WITHOUT a question re: regexs of some sort? What exactly about the regex syntax is within the sphere of "the spirit of ruby", where a scalar ".." is not? Which is easier to learn? To read? > I meant it was ugly and obtuse, and no one would ever think otherwise > unless he was used to Perl. More so than regexes? > I don't know if you're serious about "grep" or not. My only complaint > with it is the name. A unixism which has a nonintuitive name should > perhaps have an intuitive alias. No, not serious in the slightest, except from a purely academic standpoint. The point I'm attempting to make is along the lines of "whose ox is getting gored?" ".." in a scalar context is ugly and obtuse, and yet people are willing to put up with names like "grep", regexs, and a myriad of other things that they would accept as perfectly natural, and only because that's their personal context and area of familiarity.