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-Thread: 103376,334f9012742e58fc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Gnat GPL 2010 available soon (conditional expressions) Date: Tue, 29 Jun 2010 14:28:32 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <2010061621145016807-sjs@essexacuk> <0fa4c574-9539-492f-8514-d32c68beb22a@w31g2000yqb.googlegroups.com> <1frrgtpa5dycl$.12kl72iqsg3dx$.dlg@40tude.net> <4c270613$0$6974$9b4e6d93@newsspool4.arcor-online.net> <1wuwvzgwlwgli$.1birkinieia0d$.dlg@40tude.net> <1ur19ais2ejih.mjbgdsv9pr66.dlg@40tude.net> <4c275562$0$6987$9b4e6d93@newsspool4.arcor-online.net> <4c276114$0$2378$4d3efbfe@news.sover.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1277839715 27175 69.95.181.76 (29 Jun 2010 19:28:35 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 29 Jun 2010 19:28:35 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:12962 Date: 2010-06-29T14:28:32-05:00 List-Id: "Peter C. Chapin" wrote in message news:4c276114$0$2378$4d3efbfe@news.sover.net... ... > Also I find that when skimming program text just knowing that something > is conditional is sometimes enough for me to decide if I have to read it > more closely or not. If it says > > X := (if Rare_Condition then > Complicated_Expression > else > Complicated_Expression); > > I might be able to quickly tell which complicated expression I need to > look at without having to study both. Note that one advantage of conditional expressions is that they can avoid duplicating code. For instance, X(Index_Expression*Index_Base + 1) := (if Condition then Complicated_Expression else Other_Complicated_Expression); Probably is preferable to if Condition then X(Index_Expression*Index_Base + 1) := Complicated_Expression; else X(Index_Expression*Index_Base - 1) := Other_Complicated_Expression; end if; because it is much less likely to have a subtle error (like the second example I wrote above). I find that I write quite a bit of code of the second form, and I know I'd save time debugging if I had the first. Randy. P.S. But the resolution of conditional expressions is surprisingly complex. I think we've got it right, finally.