On 4/9/13 11:42 AM, Dicebot wrote:
On Tuesday, 9 April 2013 at 15:20:48 UTC, Andrei Alexandrescu wrote:
Not gonna argue latter but former is just wrong.

struct Test
{
int a;
pure int foo1() // strong pure
{
return 42;
}

pure int foo2() // weak pure
{
return a++;
}
}

Signature is the same for both functions.

Both are weakly pure.

Andrei

And that is even more surprising as foo2 perfectly matches concept of
pure and can be applied all possible optimizations to. It is weird.

I disagree about it being weird.

"weak pure" is useful only to implement "strong pure". "strong pure" is
useful only if it can be statically enforced to provide some guarantees.
"strong pure" is useless because it shares same annotation with "weak
pure".

I think it's a great design, very useful and innovative.


Andrei

Reply via email to