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,35d52809fb2aac8f X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!newshub.sdsu.edu!flpi089.ffdc.sbc.com!prodigy.net!flpi088.ffdc.sbc.com!prodigy.com!flpi107.ffdc.sbc.com!nlpi070.nbdc.sbc.com.POSTED!cfe18fef!not-for-mail From: Gary Scott Organization: Home User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Naming convention to identify functions with side effects 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> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 68.94.37.188 X-Complaints-To: abuse@prodigy.net X-Trace: nlpi070.nbdc.sbc.com 1223133278 ST000 68.94.37.188 (Sat, 04 Oct 2008 11:14:38 EDT) NNTP-Posting-Date: Sat, 04 Oct 2008 11:14:38 EDT X-UserInfo1: Q[R_@SZETRRACPD[MZHLN\TDFZ\@@FXLM@TDOCQDJ@_@FNHB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN Date: Sat, 04 Oct 2008 10:14:33 -0500 Xref: g2news2.google.com comp.lang.ada:7959 Date: 2008-10-04T10:14:33-05:00 List-Id: (see below) wrote: > On 04/10/2008 13:30, in article > d49286ef-faa1-4b1b-8e23-0ed80c015dd2@p10g2000prf.googlegroups.com, "Marco" > wrote: > > >>On Oct 3, 5:28 am, "Dmitry A. Kazakov" >>wrote: >> >>>Side-effects are bad in any subprograms, be them functions or procedures. >> >> Technically "side-effects" are being used whenever you change an >>internal state in a module, which is not always undesired. > > > These are not "side-effects", they are just effects. > The whole point of using computers is to cause changes of state. Some consider non-pure to include 1) changes in state of some "global" (non-local) entity (especially volatile items that can have state changed externally such as an I/O device) and 2) uses an argument return value in addition to a function return. All of those are "side-effects". The idea is that functions are only for calculating the return value based upon argument inputs. > > >>proper expression is "unrelated side-effects are bad" which violates >>the Principle of Least Surprise. > > > Quite so. -- Gary Scott mailto:garylscott@sbcglobal dot net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html If you want to do the impossible, don't hire an expert because he knows it can't be done. -- Henry Ford