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,7728b533f7ab5fb6 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read4.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9752 Newsgroups: comp.lang.ada Subject: Re: Avoiding side effects References: From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 08 Oct 2008 05:16:22 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read4.inet.fi 1223442982 194.251.142.2 (Wed, 08 Oct 2008 08:16:22 EEST) NNTP-Posting-Date: Wed, 08 Oct 2008 08:16:22 EEST Organization: Sonera Customer Xref: g2news1.google.com comp.lang.ada:2275 Date: 2008-10-08T05:16:22+00:00 List-Id: "(see below)" writes: > On 07/10/2008 15:47, in article uprmc4g3i.fsf@no.email.thanks.invalid, > "Anders Wirzenius" wrote: > > > "(see below)" writes: > > > >> On 07/10/2008 12:08, in article wvbrfxn8hdc7.fsf@sun.com, "Ole-Hjalmar > >> Kristensen" wrote: > >> > >>> Yes, I think any program which use a read/write interface to a file > >>> will have side effects in that sense. The only way I can think of for > >>> avoiding this would be to mmap the whole file, then it will appear as > >>> an array of bytes. > >> > >> Why would stepping through an array not be thought a "side" effect? > > > > A function that returns the row of that array and only that > > would perhaps be a function without side effects. The information > > in that row can be fetched when needed. > > A function that always returns the same row of an array would be of little > use, I should think. I have a feeling that the function can be programmed so that it returns different row (numbers, or pointers in that array) depending on the content of the rows in that array ;-) function Row_Number (Row_Number_In_Other_Array : in Row_Number_Type) return Row_Number_Type is -- Return a row number one higher than the row number of the row -- identical to the row in the other array. -- Anders