To help LDC/GDC

Dicebot m.strashun at gmail.com
Tue Apr 9 08:42:37 PDT 2013


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. "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".


More information about the Digitalmars-d mailing list