< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous aricle (the previous thread)
N :the next (in thread)
|<:the previous thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
In article <E15487A8-540F-11D8-83F8-000A95CD7A8E / talbott.ws>,
Nathaniel Talbott <nathaniel / talbott.ws> wrote:
>On Jan 31, 2004, at 10:58, Michael campbell wrote:
>
>> Nathaniel Talbott wrote:
>>
>>> This rubyist will be much happier when the flip-flop is _buried_.
>>
>> Why? If you didn't like it, why would you use it?
>
>An interesting question; I'll try to give a coherent answer. First of
>all, I have to read other people's code, and if they use obscure,
>hard-to-understand constructs that I have to look up every time, it
>makes it much harder to grok what's going on. Since I learn most
>libraries by reading their code (and I often do that even when they
>have top-notch docs - I'm just that kind of guy), opaque language
>constructs are particularly biting.
>
>Secondly, and really more importantly, is the issue of aesthetics.
>Every bit of syntax, whether I use it or not, affects and reflects the
>language as a whole. One of the things I like about Ruby the language
>is that the syntax tends to explain itself. I don't use or even see for
>loops very much in Ruby code, but when I run across one, it's pretty
>obvious what's going on. The flip-flop gives me no external clues as to
>its modus operandi, and I don't like the way affects Ruby, by making a
>bit of the gem opaque, and how it reflects Ruby, when someone sees it
>and goes, "WHAT IN TARNATION IS THAT THING?!?" and I have to explain
>that Ruby unfortunately gained a few of the "P" language's bad points
>along with a lot of its good points.
>
>That's why I personally would like to see it gone, and good riddance.
>You, of course, are welcome to root for a pardon, but I just wanted to
>make sure the other side of the aisle was represented :-)
>
And just what would you replace that functionality with? It seems to me
that it would take several lines of code to replace the following
functionality:
f.each_line {|l|
if l=~/BEGIN/ .. l=~/END/
#do something in this range of lines
end
}
If you know the meaning of what '..' is doing here, it seems quite clear.
It's also clear to anyone coming from Perl to Ruby as to what is
going on here. Without the flip/flop op that code code has to become
something like:
#untested
begin_state = false
f.each_line {|l|
if l=~/BEGIN/
begin_state = true
elsif l=~/END/
begin_state = false
end
if begin_state == true
#do something in this range of lines
end
}
I've got to introduce a state variable and more conditionals and my one
line has grown into 5. Add another flip/flop operator to your parsing
code and you add another state variable and a bunch more lines. It's not
uncommon to use several of these when parsing.
Save the flip/flop!
Phil