Boost logo

Boost :

From: David Bergman (davidb_at_[hidden])
Date: 2003-10-21 11:51:31


Dave wrote:

> "David Bergman" <davidb_at_[hidden]> writes:
>
> > It has to do with purity, that Haskell is a pure language
> in the sense
> > of an expression ALWAYS evaluating to the same value, so
> that the same
> > exact expression can be substituted for that computed value
> wherever, whenever.
>
> Even I can tell that has no bearing on side-effects, though:
>
> int z;
> int f(int x) { return z = x; }
>
> f(y) is always y for any y
> still, it has side-effects.

Good, than that particular expression is transparent, in the pure sense. If
you manage to have *all other* expressions being transparent as well, you
have a pure piece of code! (That would of course mean that the side-effect
in your assignment is *never* exposed...)

"Side effect" indicates that it should affect the visible parts of the
execution, just like in the operational abstract machine in the C++
language, does it not? Writing to a memory cell which is never read is
hardly a side-effect, is it?

/David


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk