<div dir="ltr"><div class="gmail_extra">On 9 April 2013 18:04, Dicebot <span dir="ltr"><<a href="mailto:m.strashun@gmail.com" target="_blank">m.strashun@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Tuesday, 9 April 2013 at 07:57:37 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Are you saying the example above is not actually valid code?<br>
<br>
struct Foo {<br>
    int a = 0;<br>
    pure int bar( int n ) { // Weakly pure<br>
        a += n;<br>
        return a;<br>
    }<br>
}<br>
<br>
That's not pure. Call it twice with the same args, you'll different<br>
answers. How can that possibly be considered pure in any sense?<br>
And it's useless in terms of optimisation, so why bother at all? What does<br>
it offer?<br>
</blockquote>
<br></div>
It is valid code. It is "weak pure". "pure' keyword means both<br>
"strong pure" or "weak pure" depending on function body. Crap.<br>
</blockquote></div><br></div><div class="gmail_extra">How can 'weak pure' reasonably be called any kind of 'pure'? It's not pure at all. The function returns a completely different result when called twice. That's the definition of not-pure.<div>
I suggest that no D language newbie would ever reasonably expect that behaviour.</div></div></div>