previous up next     contents index
Next: Signatures Up: Units with Signatures Previous: Units with Signatures

Units with Signatures

This library defines new syntax for units with signatures. Units with signatures extend MzScheme's unit system (see MzScheme Reference Manual) to provide better name management and better error-checking at link-time.

A signature is an ordered sequence of identifiers and sub-signatures. Signatures are used in  unit-with-signature (a.k.a.  unit/sig) expressions. Just as the result of a unit expression is a unit, the result of a unit/sig is a signed unit: a unit bundled with import and export signatures. The initial signature specified in a unit/sig expression defines the export variables for the signed unit; the import clause of a unit/sig expression is a list of signatures specifying the import variables of the signed unit.

Signed units are linked with the  compound-unit-with-signature (a.k.a.  compound-unit/sig) syntactic form. When a compound-unit/sig expression is evaluated, the signatures of the linking units are verified to match the expected export and import signatures.

Signed units can be invoked with  invoke-unit-with-signature (a.k.a.  invoke-unit/sig) and  invoke-open-unit-with-signature (a.k.a.  invoke-open-unit/sig). A signed unit can be converted into a primitive unit with  unit-with-signature->unit (a.k.a.  unit/sig->unit), and a primitive unit can be given a signature with  unit->unit-with-signature (a.k.a.  unit->unit/sig).



PLT