Contracts.jl

Author eschnett
Popularity
8 Stars
Updated Last
2 Years Ago
Started In
March 2016

Contracts

Build Status Build status codecov.io

Contracts provides macros for pre- and post-conditions in functions.

Example

@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.

Future plans

  • Loops: Loop invariants and loop variants
  • Data structures: Data structure invariants
  • Allow disabling checks for performance