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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: and then... (a curiosity) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <57qdnfULQ9tzKCHVnZ2dnUVZ_tHinZ2d@comcast.com> <48bd0003$1@news.post.ch> Date: Wed, 3 Sep 2008 14:44:39 +0200 Message-ID: <18hwarztig2qb$.1dn5of8tr3zjy.dlg@40tude.net> NNTP-Posting-Date: 03 Sep 2008 14:44:39 CEST NNTP-Posting-Host: 2b3637dc.newsspool2.arcor-online.net X-Trace: DXC=FJ@J6NK68gb<6cDJZfMd_cA9EHlD;3Ycb4Fo<]lROoRa<`=YMgDjhgb?;]32NZ76f`[6LHn;2LCVn7enW;^6ZC`dIXm65S@:3>oH6BXK`OTohi X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:1894 Date: 2008-09-03T14:44:39+02:00 List-Id: On Wed, 3 Sep 2008 15:14:15 +0200, stefan-lucks@see-the.signature wrote: >>> A short-circuit "and" (instead of "and then") would not remove that choice >>> -- see the "much better style" above. >> >> But it would break the mathematical purity of "and". > > Well, if "False and F(X)" is allowed to raise an exception, this is even > worse (more far away from mathematical purity) than if "False and F(X)" is > just false -- whatever F(X) would do. Well, it depends. Consider: function F (...) return Boolean; -- May raise Some_Error exception This breaks the contract that promises a *Boolean* result. Mathematically it means that the result is not Boolean but a value from some other type Boolean_Ex is (False, True, Some_Error_Fired). Here Some_Error_Fired is an ideal "value" of Some_Error being propagated. But then "and" is also broken in its arguments and the result. In particular for "and" defined on Boolean_Ex and returning Boolean_Ex, the theorem False and X <=> X does not hold anymore. Therefore it cannot be implied. A similar logic applies to side effects. You just do the Cartesian product of the effect and the written set of values. This becomes the "true" set of values. As somebody already pointed out. People using "and" on arguments with side effects, are fooling themselves and those who are to read the program. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de