From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Avoiding side effects
Date: Mon, 13 Oct 2008 19:55:17 +0100
Date: 2008-10-13T19:55:17+01:00 [thread overview]
Message-ID: <C5195825.FC7C4%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: c3d10577-421a-4fb0-b27f-1395df583dd9@w1g2000prk.googlegroups.com
On 13/10/2008 14:21, in article
c3d10577-421a-4fb0-b27f-1395df583dd9@w1g2000prk.googlegroups.com, "Marco"
<prenom_nomus@yahoo.com> wrote:
> On Oct 13, 5:27 am, Anders Wirzenius <and...@no.email.thanks.invalid>
> wrote:
>> "(see below)" <yaldni...@blueyonder.co.uk> writes:
>>> On 08/10/2008 06:16, in article u1vyrbra1....@no.email.thanks.invalid,
>>> "Anders Wirzenius" <and...@no.email.thanks.invalid> wrote:
>>
>>>> "(see below)" <yaldni...@blueyonder.co.uk> writes:
>>
>>>>> On 07/10/2008 15:47, in article uprmc4g3i....@no.email.thanks.invalid,
>>>>> "Anders Wirzenius" <and...@no.email.thanks.invalid> wrote:
>>
>>>>>> "(see below)" <yaldni...@blueyonder.co.uk> writes:
>>
>>>>>>> On 07/10/2008 12:08, in article wvbrfxn8hdc7....@sun.com, "Ole-Hjalmar
>>>>>>> Kristensen" <ole-hjalmar.kristensen@substitute_employer_here.com> wrote:
>>
>>>>>>>> Yes, I think any program which use a read/write interface to a file
>>>>>>>> will havesideeffects 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 withoutsideeffects. 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.
>>
>>> I think this beautifully illustrates the silliness that slavish adherence to
>>> dogma inevitably produces, in programming as in finance and politics.
>>
>> The thread I started was about how to avoidsideeffects. From
>> the answers I have been reading that for a case where you compare
>> the content of two files, it is rather hard to do it with
>> functions without havingsideeffects.
>>
>> Is the dogm you refer to something like "functions withoutside
>> effects".
>>
>> I am not a professional programmer any more and I just
>> wanted to learn something aboutsideeffects. What is silly in
>> that?
>
> nothing, but I agree don't get carried away with the concept,
> Functional Programming is kind of an extreme backlash to the Object
> Oriented push of the late 80's and 90's, in the end, both are useful
FP started with LISP, ca. 1960, and turned into a major academic industry in
the early 1980s. Only AI rivals it as a wholesale waste of CS effort.
> but is important to keep as many functions "pure" as possible because
> these tend to be easier to verify and are more reusable in other
> contexts.
>
> http://en.wikipedia.org/wiki/Pure_function
>
> At work, we are trending away from the pure OO stuff to a mixed
> approach.
--
Bill Findlay
<surname><forename> chez blueyonder.co.uk
next prev parent reply other threads:[~2008-10-13 18:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 5:50 Avoiding side effects Anders Wirzenius
2008-09-30 7:48 ` Jean-Pierre Rosen
2008-09-30 9:20 ` Anders Wirzenius
2008-09-30 11:36 ` Jean-Pierre Rosen
2008-09-30 12:43 ` Anders Wirzenius
2008-09-30 10:42 ` Ludovic Brenta
2008-09-30 11:12 ` Anders Wirzenius
2008-10-02 12:56 ` Ole-Hjalmar Kristensen
2008-10-06 12:09 ` Anders Wirzenius
2008-10-07 11:08 ` Ole-Hjalmar Kristensen
2008-10-07 14:24 ` (see below)
2008-10-07 14:47 ` Anders Wirzenius
2008-10-07 14:51 ` (see below)
2008-10-08 5:16 ` Anders Wirzenius
2008-10-08 7:35 ` Dmitry A. Kazakov
2008-10-08 15:32 ` (see below)
2008-10-13 12:27 ` Anders Wirzenius
2008-10-13 13:21 ` Marco
2008-10-13 18:55 ` (see below) [this message]
2008-10-14 7:30 ` Dmitry A. Kazakov
2008-10-14 11:44 ` Colin Paul Gloster
2008-10-13 18:49 ` (see below)
2008-10-13 21:22 ` Adam Beneschan
2008-10-13 21:53 ` (see below)
2008-10-14 6:17 ` mockturtle
2008-10-14 14:58 ` Adam Beneschan
2008-10-14 6:22 ` Avoiding side effects and other dogma Anders Wirzenius
2008-10-14 13:48 ` (see below)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox