[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Features you would like to see
- From: David Given <dg@...>
- Date: Sat, 18 Aug 2007 18:41:30 +0100
-----BEGIN PGP SIGNED MESSAGE-----
John Belmonte wrote:
> David Given wrote:
>> The whole goto-considered-harmful myth has done the world a vast disservice.
>> goto is *entirely* the right construct for dealing with certain software
>> problems: for example, state machines.
> I thought coroutines were entirely the right construct for state machines.
Depends on the state machine.
For example (this is a classic example by David Tribble, not my own):
tok = gettoken();
if (tok == END)
> Actually, neither goto or nested if's are readable, but fortunately
> these two are not the only solutions as you suggest.
> Yes, minus "finally". try-finally as a solution for exception safety
> or resource cleanup is dead and best eschewed by modern languages.
That may or may not be true, based on what programming ideology you follow.
However, I'm a pragmatist. I want the tools to be available so that I, the
programmer, can make the decision whether to use them or not. So I want
try/catch/finally *and* scope(exit) primitives; they're both potentially
useful. I'll use whichever seems most appropriate to solve the problem at
hand. (I may decide to use neither and use a goto instead.)
┌── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ─── http://www.cowlark.com ───────────────────
│ "There does not now, nor will there ever, exist a programming language in
│ which it is the least bit hard to write bad programs." --- Flon's Axiom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----