[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?

On 21-Feb-04, 02:48 (CST), Andrew Suffield <asuffield@debian.org> wrote: 
> On Fri, Feb 20, 2004 at 11:13:18PM +0800, Isaac To wrote:
> > But this I'd disagree.  Sometimes in C there is really no good alternative
> > than writing a goto.  In any other language one can probably avoid those
> > (using exceptions, labeled break/continue, etc).
> For any example you can find that appears to show this, I can find an
> example which demonstrates a better way without goto.

No, you can demonstrate a *different* way which *you* judge better. 

> It would be very easy for goto freaks to prove this if it were true,
> yet none has ever been able to. So it's almost certainly false.

Sure, if you prioritize "no goto" above all else, then nobody will ever
be able demonstrate a "goto" example that is better than your example.
But to speak of "proof" and absolute "true" and "false" when the topic
is something as judgemental and context-based as code clarity is not

If you use "break" or "continue" you're using "goto", albeit in a
limited way. The advantage of the more limited forms is that they guide
your thought as to where you should direct your attention, rather than
having to go search for a label. One goal is to minimize the amount
of state that must be maintained in the coder's brain. While I prefer
to avoid "goto", there are situations where I judge a "goto" to be
less disruptive than breaking something up into subroutines. (The
only situation I can think of is resource cleanup when bailing out of
a sequence of actions, where the allocated resources depend on how
far you've gotten through the sequence.) I've no doubt that you could
write a goto-less replacement for any example I handed you, since I
certainly could do the same. I'm just saying that I find the goto-less
version less clear, and less maintainable, because it reduces conceptual
locality and requires that I keep more in my mind to understand it,
rather than less. Perhaps my brain is broken.

But at this level, coding is craftsmanship, not science. And like
all crafts, there are a lot of techniques that are simply inferior,
but often there are multiple techniques that are good, but balance
priorities in different ways, and the technique you choose depends on
the way you personally value those priorities.


Steve Greenland
    The irony is that Bill Gates claims to be making a stable operating
    system and Linus Torvalds claims to be trying to take over the
    world.       -- seen on the net

Reply to: