Memory allocation purity

via Digitalmars-d digitalmars-d at puremagic.com
Thu May 15 00:22:02 PDT 2014


On Thursday, 15 May 2014 at 06:59:08 UTC, Jonathan M Davis via 
Digitalmars-d wrote:
> And it _definitely_ has nothing to do with functional purity.

Which makes it pointless and misleading.

> Now, combined with other information, you _can_ get functional 
> purity out it -
> e.g. if all the parameters to a function are immutable, then it 
> _is_
> functionally pure, and optimizations requiring functional 
> purity can be done
> with that function.

No, you can't say it is functionally pure if you can flip a coin 
with a pure function. To do that you would need a distinction 
between "prove pure" and "assume pure" as well as having 
immutable reference types that ban identity comparison.

> So, no, purity does _not_ imply memoization.

It should, or use a different name.



More information about the Digitalmars-d mailing list