Skip to content

Commit

Permalink
Merge pull request #128 from jmdavis/pure
Browse files Browse the repository at this point in the history
Fix for issue# 8185.
  • Loading branch information
WalterBright committed Jul 2, 2012
2 parents caa63b0 + 59670a7 commit 8cc3ba6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions function.dd
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ int foo();
$(V2
<h3>$(LNAME2 pure-functions, Pure Functions)</h3>

$(P Pure functions are functions that produce the same
result for the same arguments.
$(P Pure functions are functions which cannot access global or static, mutable
state save through their arguments. This can enable optimizations based on the fact
that a pure function is guaranteed to mutate nothing which isn't passed to it,
and in cases where the compiler can guarantee that a pure function cannot
alter its arguments, it can enable full, functional purity (i.e. the guarantee
that the function will always return the same result for the same arguments).
To that end, a pure function:
)

$(UL
$(LI does not read or write any global mutable state)
$(LI does not read or write any global or static mutable state)
$(LI cannot call functions that are not pure)
$(LI can override an impure function, but an impure function
cannot override a pure one)
Expand Down

0 comments on commit 8cc3ba6

Please sign in to comment.