To help LDC/GDC
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Tue Apr 9 02:43:37 PDT 2013
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.
More information about the Digitalmars-d
mailing list