comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com (Robert Dewar)
Subject: Re: Understanding Booleans
Date: 21 Nov 2001 20:23:34 -0800
Date: 2001-11-22T04:23:34+00:00	[thread overview]
Message-ID: <5ee5b646.0111212023.17ab963d@posting.google.com> (raw)
In-Reply-To: 3BFBDF14.4B83708B@boeing.com

Jeffrey Carter <jeffrey.carter@boeing.com> wrote in message news:<3BFBDF14.4B83708B@boeing.com>...
> Preben Randhol wrote:
> > 
> >       if Get_Active (Object) = True then
> 
> Am I the only one who finds this objectionable? It ends 
> up meaning the
> same thing as
> 
> if Get_Active (Object) then


Absolute rules of style are the hobgoblins ... OK you know
the quote. But it really is appropriate here.

Write whatever is clearer to the reader, and do not think
you can avoid the obligation of figuring out what is clearer by having
absolute rules.

       if At_End_Of_File = True then

seems redundant, indeed, though objectionable seems a 
strong term to use

On the other hand

       if Status_Flags (X) = True then

may be quite clear, depending on the context ...

       if External_Data = True then

would also seem OK to me. 

Where possible choose predicate like names for tests and
then you definitely do not need the "= True".

A related query arises with

   A := (b = c) or (e = f);

some people prefer to write

   if (b = c) or (e = f) then
      A := True;
   else
      A := False;
   end if;

And often people object, but I find that sometimes the
extended form is clearer (boolean values are perfectly
ordinary values from a language point of view, but not
from a normal conceptual point of view, they are rather
special :-)



  parent reply	other threads:[~2001-11-22  4:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21  4:35 Gtkada-Prob Lars Heppler
2001-11-21  9:37 ` Gtkada-Prob Adrian Knoth
2001-11-21 18:52   ` Gtkada-Prob Preben Randhol
2001-11-21  9:38 ` Gtkada-Prob Preben Randhol
2001-11-21 10:02   ` Gtkada-Prob Count Zero
2001-11-21 17:06   ` Understanding Booleans Jeffrey Carter
2001-11-21 17:19     ` Jean-Marc Bourguet
2001-11-21 17:29     ` Preben Randhol
2001-11-21 20:05       ` Stephen Leake
2001-11-21 21:33         ` Florian Weimer
2001-11-22  4:23     ` Robert Dewar [this message]
2001-11-22 10:39       ` Preben Randhol
2001-11-22 15:51       ` Rod Chapman
2001-11-23  3:51         ` Robert Dewar
2001-11-24 20:09     ` Richard Riehle
2001-11-25  9:08       ` Pascal Obry
2001-11-25 15:06         ` Florian Weimer
2001-11-27  9:46           ` AG
2001-11-25 21:44       ` Jeffrey Carter
2001-11-21 10:19 ` Gtkada-Prob Florian Weimer
2001-11-21 10:36   ` Gtkada-Prob Preben Randhol
2001-11-21 10:39   ` Gtkada-Prob Count Zero
2001-11-21 10:50     ` Gtkada-Prob Preben Randhol
2001-11-21 10:57       ` Gtkada-Prob Lars Heppler
2001-11-21 11:53         ` Gtkada-Prob Preben Randhol
2001-11-21 12:24           ` Gtkada-Prob Florian Weimer
2001-11-21 12:57             ` Gtkada-Prob Preben Randhol
2001-11-21 17:33     ` Gtkada-Prob Adrian Knoth
2001-11-22 10:32       ` Gtkada-Prob Preben Randhol
2001-11-22 16:36         ` Gtkada-Prob Adrian Knoth
2001-11-22 21:13         ` Gtkada-Prob Jeffrey Carter
2001-11-23 10:17           ` Gtkada-Prob Preben Randhol
2001-11-26  6:47             ` Use of use, was Gtkada-Prob Anders Wirzenius
2001-11-26  9:25               ` Preben Randhol
2001-11-27  6:28                 ` Anders Wirzenius
2001-11-27 14:06                   ` Stephen Leake
2001-11-23 17:26 ` Gtkada-Prob Arnaud Charlet
replies disabled

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