doc.txt

Unit

_Unit_
_unit_

This collection provides one file:

 _unit.ss_: conveniences and idioms for mzscheme units.

======================================================================

CONCEPTS -------------------------------------------------------------

A `functor' is a function whose result is a unit with no imports. This
is analogous to a mixin. The utility of a functor is as a convenience
for constructing units that are only parameterized by a few
definitions without having to resort to the complexity of linking
compound units.


MACROS ---------------------------------------------------------------

> (new-unit sig-identifier [export-name expr] ...) :: SYNTAX

Constructs a unit with no imports that exports the given signature
by binding each export to the result of evaluate each corresponding
expression. The expressions are evaluated before the unit is
created.

> (functor lambda-formals (sig-identifier ...) linkage-decl ...) :: SYNTAX

Creates a functor with the given formal arguments that exports the
given signatures and is constructed with the given linkage
declarations. This is syntactic sugar for

(lambda lambda-formals
  (compound-unit
    (import)
    (export sig-identifier ...)
    linkage-decl ...))

> (require-unit sig-import expr) :: SYNTAX

sig-import is one of
  sig-expr
  (sig-expr ...)

Invokes a unit with no imports and defines all bindings in the
specified signatures. See the documentation for the _unit_ form
for the definition of `sig-expr'.