On Friday, 24 April 2015 at 15:43:17 UTC, anonymous wrote:
On Friday, 24 April 2015 at 15:21:43 UTC, Steven Schveighoffer wrote:
This is OK as long as f is *strong* pure. D pure is not the same as the traditional definition.

And GC.malloc is not strong pure, as it returns mutable data.

Ah, this is the piece I was missing. I was aware of weak/strong pure, but I didn't know the return type plays a role in that.

Could core.stdc.stdlib.malloc and friends also be marked pure then?

No.

Allocating on the GC is "stateless" as the GC will handle the state by itself, from the program perspective, there is no state to maintain.

malloc require free, and the state management is pushed on the application rather than the runtime. It is not pure.

Reply via email to