From: Hal Fulton Date: 2004-02-01T06:49:47+09:00 Subject: Re: Save the flip/flop op! Michael campbell wrote: > Well, I like the syntax, because I've trained my brain to understand > it. Would Ruby be as easy to read as it is now if all the reserved > words were not in English (or in ANY known "natural" spoken language)? > My point here is that anything you dont yet understand, take the time to > understand it. The reason Ruby is easy now is only because you have the > understanding of the context in/for which it was designed. Well, it runs counter to the rest of Ruby. Since x..y is a range, and never evaluates to false or nil, I would expect it always to be true. > That said, if there were some method call which can do all of what > (scalar)".." does, then fine. The beauty of this operator is that each > one has its own state (that I don't have to burn a variable to maintain > on my own), so you can nest them, have several going at once, use them > completely outside of the common per-line file processing model, etc. > I THINK Hal's solution might work outside the file-by-line context > > 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. >> Only a perler could love it. (No offense meant.) > > Playing devil's advocate...By extension then, I propose to also put up > all the unixism's as candidates for removal too, as only people who are > familiar with unix could love those too. I have to read others' code, > and I just have to grab a manual every time I see Enumerable#grep. I see your point, but I don't admit the correspondence. (My turn to play devil's advocate.) 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. I meant it was ugly and obtuse, and no one would ever think otherwise unless he was used to Perl. As for the Unixisms: There are some I have trouble with, and I have used Uniux off and on since the early 80s. 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. This reminds me of a BBS I was designing with a friend back in 1990 or so. We wanted to put in a scheduling mechanism for the sysop, and we debated how to implement it and what to call it. "Call it 'cron'," he said. "We are *not* calling it 'cron'," I told him. Hal