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!news2.google.com!news.glorb.com!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) Date: Mon, 01 Sep 2008 10:05:57 +0200 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <48bba264$1@news.post.ch> References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <874p53bij6.fsf@willow.rfc1149.net> <94cc1ce3-59d1-41fa-9167-f3b60ddd2835@a1g2000hsb.googlegroups.com> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: atlas.ip-plus.net 1220256360 12670 194.41.146.1 (1 Sep 2008 08:06:00 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Mon, 1 Sep 2008 08:06:00 +0000 (UTC) User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <94cc1ce3-59d1-41fa-9167-f3b60ddd2835@a1g2000hsb.googlegroups.com> X-Original-NNTP-Posting-Host: w03duo.pnet.ch X-Original-Trace: 1 Sep 2008 10:05:56 +0100, w03duo.pnet.ch Xref: g2news1.google.com comp.lang.ada:1851 Date: 2008-09-01T10:05:57+02:00 List-Id: Maciej Sobczak schrieb: > On 29 Sie, 23:47, Samuel Tardieu wrote: > >> Sometimes, you want to ensure that both sides of the boolean operator >> have been evaluated. Here is an example: >> >> -- Send the message to the log and return True if it >> -- has been logged at least at one place succesfully. >> >> function Log (Message : String) return Boolean is >> begin >> return Log_To_Network (Message) or Log_To_Disk (Message); >> end Log; > > This is actually a bad example. It might use "or else" and still > retain the semantics as described in the comment above. 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. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com