On 9 April 2013 19:43, Joseph Rushton Wakeling <[email protected]
> wrote:

> On 04/08/2013 08:14 PM, Simen Kjaeraas wrote:
> > Like others have stated, it's so you can do this:
> >
> > struct Foo {
> >    int a = 0;
> >    pure int bar( int n ) { // Weakly pure
> >        a += n;
> >        return a;
> >    }
> > }
> >
> > pure int Baz( int n ) { // Strongly pure
> >     Foo foo;
> >     return foo.bar( n );
> > }
>
> ... one clear application of this being pseudo-random number generation,
> where
> you have a state variable together with a (pure) update function.
>

There's nothing 'pure' about a function that has side effects. It's a
totally different concept, and should be named appropriately.

Reply via email to