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,99e73f65ea2533b9 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!edtnps82.POSTED!53ab2750!not-for-mail Sender: blaak@METROID Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <874p53bij6.fsf@willow.rfc1149.net> <94cc1ce3-59d1-41fa-9167-f3b60ddd2835@a1g2000hsb.googlegroups.com> <48bba264$1@news.post.ch> From: Ray Blaak Message-ID: Organization: The Transcend User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 01 Sep 2008 17:56:11 GMT NNTP-Posting-Host: 154.20.96.87 X-Trace: edtnps82 1220291771 154.20.96.87 (Mon, 01 Sep 2008 11:56:11 MDT) NNTP-Posting-Date: Mon, 01 Sep 2008 11:56:11 MDT Xref: g2news1.google.com comp.lang.ada:1856 Date: 2008-09-01T17:56:11+00:00 List-Id: Martin Krischik writes: > Actually it is good example - for both: > > 1) Log to both Disk and Network and return true if at least one was > successful: > > Log_To_Network (Message) or Log_To_Disk (Message) > > 2) Log to Network and if that fails log to Disk and return true if at > least one was successful: > > Log_To_Network (Message) or else Log_To_Disk (Message) > > And it shows nicely the why there are two: The programmer can decide > which behaviour he / she wants. My problem is not with the theoretical elegance as such, but rather that "or" vs "or else" is not immediately clear to me. As a multi-language programmer, I am really really used to thinking of boolean or as "if one is true we don't care about the other". This instinct is reenforced both from the current popular languages as well as from formal proof styles in programming methodology. So, I don't like relying the execution of both disjuncts. Sure, I could use "or else" consistently, but I like thinking of boolean or as good old regular boolean or. So, my preference for the first log example (do both, return success of at least one is: declare Network_Logged : Boolean := Log_To_Network(Message); Disked_Logged : Boolean := Log_To_Disk(Message); begin return Network_Logged or Disked_Logged; end; -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.