Invoking with Exports to a Namespace: invoke.ss

Next: Macros: macro.ss Up: MzLib Libraries Previous: Inflating Compressed Data: inflate.ss

## Invoking with Exports to a Namespace: `invoke.ss`

Files: `invoke.ss`

`(`define-values/invoke-unit` `(`export-id `)` unit-expr [prefix import-id ])` SYNTAX

Similar to `invoke-unit`. However, instead of returning the value of the unit's initialization expression, `define-values/invoke-unit` expands to a `define-values` expression that binds each identifier export-id to the value of the corresponding variable exported by the unit. At run time, if the unit does not export all of the export-ids, the `exn:unit` exception is raised.

If prefix is specified, it must be either `#f` or an identifier. If it is an identifier, the names defined by the expansion of `define-values/invoke-unit` are prefixed with `prefix:`.

Example: ``

      (define x 3)
      (define y 2)
      (define-values/invoke-unit (c)
         (unit (import a b)
               (export c)
            (define c (- a b)))
         ex
         x y)
      ex:c ; => 1

`(`define-values/invoke-unit/sig` signature unit/sig-expr [prefix invoke-linkage ])` SYNTAX

The signed-unit version of `define-values/invoke-unit`. The names defined by the expansion of `define-values/invoke-unit/sig` are determined by flattening the signature specified before unit-expr, then adding the prefix (if any). See section 7.3.1.1 for more information about signature flattening.

Each invoke-linkage is either signature or `(identifier : signature)`, as in `invoke-unit/sig`.

`(`global-define-values/invoke-unit` `(`export-id `)` unit-expr [prefix import-id ])` SYNTAX

Like `define-values/invoke-unit`, but the expansion is a sequence of calls to `global-defined-value` instead of a `define-values` expression. Thus, when it is evaluated, a `global-define-values/invoke-unit` expression binds top-level variables in the current namespace.

`(`global-define-values/invoke-unit/sig` signature unit/sig-expr [prefix invoke-linkage ])` SYNTAX

The signed-unit version of `global-define-values/invoke-unit`. See also `define-values/invoke-unit/sig`.