comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: A question re meaning/use of the "for ... use ..."
Date: Wed, 8 Dec 2004 16:23:37 +0000 (UTC)
Date: 2004-12-08T16:23:37+00:00	[thread overview]
Message-ID: <cp79q9$3rr$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 41b6bc76$1_1@baen1673807.greenlnk.net

Martin Dowie <martin.dowie@baesystems.com> wrote:
: Clearly this is a lot less important than extra libraries, interfaces, etc.
: but I have wondered this before myself and I think it would improve program
: readability quite a bit.

As for "when expression" everywhere, I do not think so.

In
  exit when expression

it is quite clear what is going to happen when expression is true.

In
  return expression when expression

the second expression might be off the radar when you read
  return expression.
In fact, I've used this kind of syntactical arrangement a lot in Perl
programs and was told not to do so. I think this was good advice.
Reading "return E when E" requires a lot of "conditional shuffling"
and "reading back". Worse, you could write

  if expression then
    return expression when expression

ending up with a well hidden multiple exit problem due to TIMTOWTDI.
(I hope I have not repeated the Ada comments arguments.)


-- Georg



  reply	other threads:[~2004-12-08 16:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-05 15:27 A question re meaning/use of the "for ... use ..." Erik J Pessers
2004-12-05 15:47 ` Martin Krischik
2004-12-05 15:59 ` Stephen Leake
2004-12-05 16:52   ` Jeffrey Carter
2004-12-06 19:59     ` Randy Brukardt
2004-12-07  1:36       ` Jeffrey Carter
2004-12-07  2:40         ` David C. Hoos, Sr.
2004-12-07 20:59         ` Randy Brukardt
2004-12-08  1:41           ` Jeffrey Carter
2004-12-08  8:40           ` Martin Dowie
2004-12-08 16:23             ` Georg Bauhaus [this message]
2004-12-08  3:18       ` Keith Thompson
2004-12-08 13:48         ` David C. Hoos
2004-12-08 19:50         ` Randy Brukardt
2004-12-08 23:00           ` Keith Thompson
2004-12-09 23:06             ` Randy Brukardt
2004-12-10  2:26               ` Keith Thompson
2004-12-10 19:42                 ` Randy Brukardt
2004-12-10 21:18                   ` Keith Thompson
2004-12-11  0:53                     ` Keith Thompson
2004-12-10  3:13             ` David C. Hoos
2004-12-10  9:23               ` Keith Thompson
2004-12-10 13:24                 ` David C. Hoos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox