rebellion icon indicating copy to clipboard operation
rebellion copied to clipboard

Multicontracts

Open jackfirth opened this issue 5 years ago • 0 comments

It's hard to write contracts that check for some relationship between two values. For example, a contract for list-ref that verifies the index is less than the length of the list. The usual way to do this is with dependent contracts, but there's two problems:

  1. Performance. The contract (and any associated blame objects) has to be reconstructed for every call.

  2. Semantics mismatch. It's not always clear which direction the dependency relationship should go. Should the contract for the position depend on the list, or should the contract for the list depend on the position?

Maybe there there should be "multicontracts", which would be like contracts except they can be applied to multiple values. Each multicontract would have an arity that specifies how many values it can be applied to.

jackfirth avatar Feb 20 '20 02:02 jackfirth