Memory allocation purity

Meta via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 17:07:23 PDT 2014


On Thursday, 15 May 2014 at 00:00:37 UTC, Walter Bright wrote:
> On 5/14/2014 3:42 PM, Brian Schott wrote:
>> If malloc can never be considered pure, even when hidden 
>> behind an allocator,
>
> It cannot be pure as long as it can fail.
>
>> why can it be considered pure when hidden behind the GC?
>
> Because GC failures are not recoverable, so the pure allocation 
> cannot fail.

Malloc is a tricky case. The results it returns are theoretically 
always unique, and it is referentially transparent if we pretend 
that we have infinite memory.


More information about the Digitalmars-d mailing list