6.9 Unit Contracts
|(unit/c (import sig-block ...) (export sig-block ...))|
|sig-block|| ||=|| ||(tagged-sig-id [id contract] ...)|
| || ||||| ||tagged-sig-id|
A unit contract
wraps a unit and checks both its imported and
exported identifiers to ensure that they match the appropriate contracts.
This allows the programmer to add contract checks to a single unit value
without adding contracts to the imported and exported signatures.
The unit value must import a subset of the import signatures and export a
superset of the export signatures listed in the unit contract. Any
identifier which is not listed for a given signature is left alone.
Variables used in a given contract expression first refer to other
variables in the same signature, and then to the context of the
|sig-spec-block|| ||=|| ||(tagged-sig-spec [id contract] ...)|
| || ||||| ||tagged-sig-spec|
form defines an unit compatible with
link inference whose imports and exports are contracted with a unit
contract. The unit name is used for the positive blame of the contract.