<div dir="ltr">2013/4/9 Dicebot <span dir="ltr"><<a href="mailto:m.strashun@gmail.com" target="_blank">m.strashun@gmail.com</a>></span><br><div class="gmail_extra"><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 12:56:04 UTC, Andrei Alexandrescu 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"><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">
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>
<br>
s/body/signature/<br>
s/Crap/Awesome/<br>
</blockquote>
<br></div>
Not gonna argue latter but former is just wrong.<br>
<br>
struct Test<br>
{<br>
int a;<br>
pure int foo1() // strong pure<br>
{<br>
return 42;<br>
}<br>
<br>
pure int foo2() // weak pure<br>
{<br>
return a++;<br>
}<br>
}<br>
<br>
Signature is the same for both functions.<br>
</blockquote></div><br></div><div class="gmail_extra" style>Both have weak pure. Purity is always calculated only from the function signature.</div><div class="gmail_extra" style>If you make member function "strong pure", _at least_ it should be qualified with "immutable".</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style> pure int foo3() immutable // strong pure<br> {<br> return 10;<br> }<br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>
Kenji Hara</div></div>