On Tuesday, 9 April 2013 at 07:57:37 UTC, Manu wrote:It is valid code. It is "weak pure". "pure' keyword means both
Are you saying the example above is not actually valid code?
struct Foo {
int a = 0;
pure int bar( int n ) { // Weakly pure
a += n;
return a;
}
}
That's not pure. Call it twice with the same args, you'll different
answers. How can that possibly be considered pure in any sense?
And it's useless in terms of optimisation, so why bother at all? What does
it offer?
"strong pure" or "weak pure" depending on function body. Crap.