From: Gary Scott <garylscott@sbcglobal.net>
Subject: Re: Naming convention to identify functions with side effects
Date: Sat, 04 Oct 2008 10:14:33 -0500
Date: 2008-10-04T10:14:33-05:00 [thread overview]
Message-ID: <yLLFk.2192$x%.1244@nlpi070.nbdc.sbc.com> (raw)
In-Reply-To: <C50D28B0.FB1BD%yaldnif.w@blueyonder.co.uk>
(see below) wrote:
> On 04/10/2008 13:30, in article
> d49286ef-faa1-4b1b-8e23-0ed80c015dd2@p10g2000prf.googlegroups.com, "Marco"
> <prenom_nomus@yahoo.com> wrote:
>
>
>>On Oct 3, 5:28 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
>>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
next prev parent reply other threads:[~2008-10-04 15:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-29 18:17 Naming convention to identify functions with side effects Hibou57 (Yannick Duchêne)
2008-09-29 18:45 ` Hibou57 (Yannick Duchêne)
2008-09-29 18:55 ` Adam Beneschan
2008-09-29 19:52 ` Dmitry A. Kazakov
2008-09-29 20:48 ` Georg Bauhaus
2008-09-29 21:10 ` Adam Beneschan
2008-09-30 15:17 ` Georg Bauhaus
2008-09-30 17:40 ` Ray Blaak
2008-10-02 12:33 ` Ole-Hjalmar Kristensen
2008-10-03 9:18 ` Georg Bauhaus
2008-10-06 7:24 ` Ole-Hjalmar Kristensen
2008-10-03 11:51 ` Brian Drummond
2008-10-03 12:28 ` Dmitry A. Kazakov
2008-10-04 12:30 ` Marco
2008-10-04 13:05 ` (see below)
2008-10-04 15:14 ` Gary Scott [this message]
2008-10-11 11:32 ` Marco
2008-10-11 14:57 ` Dmitry A. Kazakov
2008-10-11 16:05 ` (see below)
2008-10-11 17:49 ` Georg Bauhaus
2008-10-11 18:42 ` (see below)
2008-10-03 13:15 ` Jeffrey Creem
2008-09-29 20:57 ` Georg Bauhaus
2008-09-29 22:22 ` Dr. Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox