countvajhula / social-contract

High-level, composable syntax for describing contracts in Racket.
3 stars 1 forks source link

Consider supporting a numeric parameter in function/c and variadic-function/c #6

Closed countvajhula closed 3 years ago

countvajhula commented 3 years ago

This could allow something like (function/c 3) (just illustrative - not real syntax) to indicate a ternary (3-argument) function, without having to resort to (-> ctc ctc ctc ctc).

This is just a vague idea at the moment - it requires more design effort to see how the syntax could be intuitive and specify a subset of contracts and so on.

Probably affects: function/c predicate/c composition/c constructor/c variadic-function/c variadic-predicate/c variadic-composition/c variadic-constructor/c

This could warrant a generalization of the provided forms to be more of a DSL so that such numeric arguments could compose with any other specifications pertaining to the contracts. (Related: #2 )

countvajhula commented 3 years ago

Contracts whose definition involves repetition of some input or output contract now support numeric arguments - e.g. composition/c, operator/c. Most other contracts now support a "paramspec" subform where extra arguments can be indicated individually.