Python vs D [ was Re: Bartosz about Chapel ]
Walter Bright
newshound2 at digitalmars.com
Thu Nov 10 03:34:07 PST 2011
On 11/10/2011 2:00 AM, Russel Winder wrote:
> Purity is not really something I understand here without some lead in.
> I guess I failed to read part of Andrei's book ;-)
A pure function in D is one that has no side effects. It is set by adding the
keyword "pure" to a function, and is checked by the compiler.
A pure function may not modify any data reachable through its parameters, may
not read or write to any mutable global state, and can only call functions that
also are either pure or restrict the variables they modify to those of the
calling pure function's.
A pure function may allocate data via new, and may throw an exception.
More information about the Digitalmars-d
mailing list