From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,577df5d4a0e88785 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-11 20:56:35 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!europa.netcrusader.net!205.252.116.205!howland.erols.net!newsfeed.mindspring.net.MISMATCH!news.mindspring.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3A35AFFF.CA2BA2F9@acm.org> From: Jeff Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: constant string array References: <910u3p$v9j$1@nnrp1.deja.com> <3A3445A8.8FC404D5@acm.org> <912ut9$fga$1@nnrp1.deja.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 12 Dec 2000 04:56:30 GMT NNTP-Posting-Host: 165.121.233.185 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 976596990 165.121.233.185 (Mon, 11 Dec 2000 20:56:30 PST) NNTP-Posting-Date: Mon, 11 Dec 2000 20:56:30 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: supernews.google.com comp.lang.ada:2977 Date: 2000-12-12T04:56:30+00:00 List-Id: Robert Dewar wrote: > There is a conceptual difference between using a boolean > expression in a test, and using it as a general value (indeed > it is this conceptual difference that leads ABC to allow > "boolean" expressions ONLY in the context of a test. ABC? > I think the argument is even stronger in comparing: > > a := b > c; > > with > > if b > c then > a := true; > else > a := false; > end if; > > I always used to criticize students for the spelled out version > giving the canonical advice to replace it with the use of a > boolean expression. But in fact I think the spelled out version > is often clearer in its intent. > > You can get some feeling for this by supposing that someone > looking at the above code decides to replace > > A : boolean; > > by > > type motor_status is (on, off); > a : motor_status; > > with a revision history saying > > use ON/OFF for motor status instead of True/False, makes > code clearer. Hopefully your style checker will flag your inconsistent capitalization. Obviously, I disagree with your premise. In all of your examples I find the use of a Boolean expression as a value clearer than the version with an if. If the type of a variable changes, you should expect to have to make changes everywhere it is used. I certainly expect some of those changes to be non-trivial. What is important is to use a language that flags any places where the use of the variable has been missed, rather than one that silently compiles the meaningless code. I have found that this kind of construct generally indicates a lack of understanding of Booleans, frequently from people with experience with languages that do not have a Boolean type. Such people frequently do other irritating things, like putting unnecessary parentheses around the condition of an if, and forgetting the "then". Learning that Boolean is a type like any other enumeration type, and its values no different than any other enumeration type, is often a major step in grasping the Ada mind set. -- Jeff Carter "I blow my nose on you." Monty Python & the Holy Grail