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-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 03 Oct 2008 06:44:38 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Naming convention to identify functions with side effects Date: Fri, 03 Oct 2008 12:51:33 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <5654ee5f-aa9f-4fff-87e0-45854b850f26@y38g2000hsy.googlegroups.com> <29ac62e1-78da-4048-ad95-8f88a29f7d31@z6g2000pre.googlegroups.com> <48e13f14$0$6610$9b4e6d93@newsspool3.arcor-online.net> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-lyavTsp8S5edUE1kOj7ymyIPCRTAPlPa53zvTCFE+w5UAtgOc7n/4A7nkFsDPVfg/84iLB7l3lee6GW!PG4GkQ/rVmiP12bST3giXC1Jpgo/9ch2UP7CTyTANzJrTphVvCRc7ZHW/qFV7fcfqeXQQR+JHnUw X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news2.google.com comp.lang.ada:7940 Date: 2008-10-03T12:51:33+01:00 List-Id: On Mon, 29 Sep 2008 22:48:20 +0200, Georg Bauhaus wrote: >Dmitry A. Kazakov wrote: >> On Mon, 29 Sep 2008 11:55:49 -0700 (PDT), Adam Beneschan wrote: > >>> if Web_Page_Is_Loaded ("http://www.irvine.com") then... >>> if Load_Web_Page ("http://www.irvine.com") then... >> >> I don't like either. > >Me neither. > >Some issues become more obvious in a concurrent setting >perhaps, > > Web_Page.Load ("http://www.irvine.com"); > > if Web_Page.Is_Loaded then... > >There needs to be a lock of some sort joining the two calls. >Otherwise, the Web_Page object might have changed >between the two calls, a logic error. As someone relatively new to Ada, I have to ask, is there need for anything more sophisticated than Web_Page.Load ("http://www.irvine.com", Loaded); if Loaded then... which avoids side effects in functions, preserves the atomicity of the operation and test, but allows the test result to be used later. (The web page may indeed change, but "Loaded" refers to the version extant during the .Load call) Its intent and operation are quite clear, and it's a common paradigm in other languages. Beyond being a little untidy, is there any reason for avoiding it? - Brian