Next: Flattening Signatures Up: Units with Signatures Previous: Units with Signatures

## Signatures

A signature is either a signature description or a bound signature identifier: ``

      (sig-element   )
      signature-identifier

      sig-element is one of:
         variable
         (struct base-identifier (field-identifier   ) omission   )
         (open signature)
         (unit identifier : signature)

      omission is one of:
         -selectors
         -setters
         (- variable)

Together, the element descriptions determine the set of elements that compose the signature:

- The simple variable form adds a variable name to the new signature.
- The `struct` form expands into the list of variable names generated by a `define-struct` expression with the given base-identifier and field-identifiers.

  The actual structure type can contain additional fields; if a field identifier is omitted, the corresponding selector and setter names are not added to the signature. Optional omission specifications can omit other kinds of names: `-selectors` omits all field selector variables. `-setters` omits all field setter variables, and `(- variable)` omits a specific generated variable.

- The `open` form copies all of the elements of another signature into the new signature description.
- The `unit` form creates a sub-signature within the new signature. A signature that includes a `unit` clause corresponds to a signed compound unit that exports an embedded unit. (Embedded units are described in section 7.2.4 and section 7.3.3.)

The names of all elements in a signature must be distinct. Two signatures match when they contain the same element names, and when a name in both signatures is either a variable name in both signatures or a sub-signature name in both signatures such that the sub-signatures match. The order of elements within a signature is not important. A source signature satisfies a destination signature when the source signature has all of the elements of the destination signature, but the source signature may have additional elements.

The `define-signature` form binds a signature to an identifier: ``

      (define-signature signature-identifier signature)

The `let-signature` form binds a signature to an identifier within a body of expressions: `

      (let-signature identifier signature body-expr   )

` Internal `define-signature` expressions are transformed into `let-signature` expressions.

- Flattening Signatures

Next: Flattening Signatures Up: Units with Signatures Previous: Units with Signatures