Memory allocation purity

via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 23:18:54 PDT 2014


On Thursday, 15 May 2014 at 05:51:16 UTC, Ola Fosheim Grøstad 
wrote:
> However mmap to a fixed address is pure if it throws an 
> exception on failure because the exception bypass the call site 
> of the pure function (pure functions should not catch side 
> effect exceptions).

This of course presumes a transactional view, that the 
transaction is the context of purity and that flaws in purity 
unwinds all changes and thus abort the transaction (the try 
block).

If the result of a series of pure function calls can be used to 
flip a coin within a transaction, then those functions cannot be 
considered pure in any meaningful sense.


More information about the Digitalmars-d mailing list