2 ms·
Basically this could be something like this, D based example: void process_list(List aList) in(aList.isSorted, "List must be sorted!") do {
by pjmlp 1y ago
Basically this could be something like this, D based example:
void process_list(List aList)
in(aList.isSorted, "List must be sorted!")
do
{
// do something
}
However the O() cost of calling isSorted() has an impact on overall cost for process_list() on every call, hence why the way contracts are executed is usually configurable in languages that have them available.