On Sunday, 28 May 2017 at 23:49:16 UTC, Brad Roberts wrote:
// do something arbitrarily complex with s that doesn't
touch globals or change global state except possibly state of
the heap or gc
Sounds like the basic definition of pure to me; At least in
regards to D. Memory allocation which is a system call, doesn't
actually break purity. Then again if you were worried about not
using the gc, there's the newer nogc property.
[quote]
TDPL pg. 165: 5.11.1 Pure functions
In D, a function is considered pure if returning a result is
it's only effect and the result depends only on the function's
arguments.
[/quote]