purity question

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 29 01:49:07 PDT 2017


Brad Roberts wrote:

> libraries that themselves aren't marked pure, there's a real need for 
> escape hatches.  A simple example: anything that has a malloc/free pair.

they aren't pure. it is a sad misconception about purity, which D makes 
even more complex by allowing to mark, for example, *setters* as pure. but 
still, `malloc()` and `free()` aren't pure. and while various functions in 
std.math, for example, are marked `pure`, they aren't too.


More information about the Digitalmars-d-learn mailing list