To help LDC/GDC

Manu turkeyman at gmail.com
Tue Apr 9 03:28:03 PDT 2013


On 9 April 2013 19:43, Joseph Rushton Wakeling <joseph.wakeling at webdrake.net
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130409/df3d0761/attachment.html>


More information about the Digitalmars-d mailing list