Contracts provides macros for pre- and post-conditions in functions.
@contract function f(x, y)
requires(x < y)
ensures(result > x)
x^2 + y^2
end
There is a current discussion on the Julia mailing list regarding the
names of these features. So far, the names precondition
, pre
,
require
, and requires
have been proposed.
- Loops: Loop invariants and loop variants
- Data structures: Data structure invariants
- Allow disabling checks for performance