<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 12 January 2014 11:05, Peter Alexander <span dir="ltr"><<a href="mailto:peter.alexander.au@gmail.com" target="_blank">peter.alexander.au@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sunday, 12 January 2014 at 00:50:30 UTC, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 12 January 2014 04:52, Adam D. Ruppe <<a href="mailto:destructionator@gmail.com" target="_blank">destructionator@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Saturday, 11 January 2014 at 18:48:15 UTC, Maxim Fomin wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It is legal exactly because function is marked as pure. Result of pure<br>
function is implicitly convertible to immutable.<br>
<br>
</blockquote>
<br>
It shouldn't be here though... the reason it is implicitly convertable is<br>
that pure means the result is unique.<br>
</blockquote>
<br>
<br></div><div class="im">
Can you explain how this is true? I can't see anything about the concept of<br>
purity that suggests the result should be unique...<br>
Pure just means given the same inputs, it will produce the same outputs;<br>
external state can't affect the calculation.<br>
</div></blockquote>
<br>
How could the result not be unique, or at least immutable? Pure functions cannot read mutable global state, so any global state returned must be immutable. Strong pure functions can also only have immutable arguments, so anything returned from those will be immutable. The only other thing that can be returned must be created within the function, which will be unique, and safely converted to immutable.<br>

</blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">But pure functions can (and do) return their arguments, and it's obviously not a 'strongly pure' function. So I just can't see how the assertion that it should be unique stands?</div>
<div class="gmail_extra">Also, I was under the impression a 'strongly pure' function's arguments only need to be const, not necessarily immutable. Purity says something about the transformation performed by the function, nothing about the data it operates on.</div>
<div class="gmail_extra">Why should all arguments need to be immutable?</div></div>