On Wednesday, 10 April 2013 at 18:24:22 UTC, Walter Bright wrote:
On 4/9/2013 1:33 AM, Manu wrote:
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.
I suggest that no D language newbie would ever reasonably
expect that behaviour.
I explained it in another reply here.
I agree that it is initially confusing. I was myself confused
about it until Don set me straight!
For some reason I was never confused by this issue, even though
I'm clearly in the minority. I always thought 'pure' set up an
isolated set of instructions which only behaved according to what
it was given. So if I found out it could modify by reference, it
didn't shake my basic idea of what it was supposed to do. As long
as it modified in exactly the same way, it still seemed like a
separate and predictable box.