comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Lorenzen <mark.lorenzen@ofir.dk>
Subject: Re: Short circuit boolean evaluation
Date: Fri, 07 Nov 2003 01:26:12 +0100
Date: 2003-11-07T01:26:12+01:00	[thread overview]
Message-ID: <m3u15hqb17.fsf@niflheim.malonet> (raw)
In-Reply-To: 87f5a614.0311061144.360b3325@posting.google.com

svaa@ciberpiula.net (svaa) writes:

> "Steve" <nospam_steved94@comcast.net> wrote in message news:<Vwjqb.115053$HS4.999172@attbi_s01>...
>> I consider it unimaginable to make such a fundamental change to a language
>> in order to save a few keystrokes when more than a few billion lines of
>> source code might be effected.
>
> I wouldn't call it a few  keystrokes, I use it in every condition. 
>
> Anyhow, that's not the problem, the problem is that short-circuit has
> clearly proved to be better, I supose that the idea of Ada0x is to add
> new features and remove flaws. Backward compatibility is a problem,
> but it could be resolved with pragmas etc. Most sofware have eventualy
> made changes that had backward compatibility problems. Probably a big
> problem with backward compatibility means a big improvent for future
> developments.

Has clearly proved to be better? Where do you get that idea from?

>
> Sure we can live with full evaluation, but we can live better with
> short circuit. If we accept that short circuit is better than full
> evaluation, the change must be done, sooner or later. This time is as
> good or bad as any another.

Why should we accept that?

>
> Perhaps Ada0x could let the full evaluation as default, but add a
> pragma that allows short circuit, and in ada1x make it as default. (it
> doesn't means make illegal "and then" operator). Ada has fame of
> bloated and burden syntax, things like this doesn't help. I think it
> is time and make good changes, even if they are deep. It's not time to
> be conservative, but brave.
>
> Will we carry "and then" in ada5x? Will we accept that flaw (a minor
> flaw, but a flaw) in the first version must remain for ever?.

Why is it that every time someone complaints about the difference
between Ada and other languages, that it is Ada that is flawed?

Please explain why you want to use:

if (Alarm_Is_On and then Operator_Is_Alerted) then
  Wait_For_Operator;
else
  Call_Fire_Brigade;
end if;

instead of:

if (Alarm_Is_On and Operator_Is_Alerted) then
  Wait_For_Operator;
else
  Call_Fire_Brigade;
end if;

By using the first version you explicitly explain to the reader that
there is something fishy going on when evaluating Operator_Is_Alerted,
since it may only be evaluated if Alarm_Is_On evaluates to true. Is
there something fishy going on, or are you just giving the reader
superfluous information, that may confuse him when he has to maintain
the code in 10 years time?

- Mark Lorenzen



  parent reply	other threads:[~2003-11-07  0:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-05 23:28 Short circuit boolean evaluation svaa
2003-11-06  3:49 ` Steve
2003-11-06 19:44   ` svaa
2003-11-06 23:03     ` tmoran
2003-11-07  0:26     ` Mark Lorenzen [this message]
2003-11-07 21:27       ` Simon Wright
2003-11-07 22:59         ` Mark Lorenzen
2003-11-07  2:29     ` Wes Groleau
2003-11-07  3:48     ` Steve
2003-11-10 11:18     ` Georg Bauhaus
2003-11-07  0:49 ` Gautier Write-only
2003-11-07  3:03   ` Alexandre E. Kopilovitch
2003-11-10 17:36   ` Warren W. Gay VE3WWG
replies disabled

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