On Thursday, 15 May 2014 at 01:33:36 UTC, Idan Arye wrote:
On Wednesday, 14 May 2014 at 22:50:10 UTC, w0rp wrote:
I think even C malloc should be considered pure. True, it
affects global state by allocating memory, but it never
changes existing values, it just allows for new values. free
is pure because it isn't side-effecting, it deallocates what
you give it. That's just my perspective on it though, others
might have other views on it.
`free` is not pure, because if you have a reference to that
memory that reference is no longer valid.
It is weakly pure, i.e., it can only affect the world through the
parameters given to it (and the state of the computer's memory...
but we should ignore that).