► |  | The Racket Reference

1 | Language Model
2 | Notation for Documentation
3 | Syntactic Forms
4 | Datatypes
5 | Structures
6 | Classes and Objects
7 | Units
8 | Contracts
9 | Pattern Matching
10 | Control Flow
11 | Concurrency and Parallelism
12 | Macros
13 | Input and Output
14 | Reflection and Security
15 | Operating System
16 | Memory Management
17 | Unsafe Operations
18 | Running Racket
| Bibliography
| Index

▼ | 7 | Units

7.1 | Creating Units
7.2 | Invoking Units
7.3 | Linking Units and Creating Compound Units
7.4 | Inferred Linking
7.5 | Generating A Unit from Context
7.6 | Structural Matching
7.7 | Extending the Syntax of Signatures
7.8 | Unit Utilities
7.9 | Unit Contracts
7.10 | Single-Unit Modules
7.11 | Single-Signature Modules
7.12 | Transformer Helpers

On this page:

unit-static-signatures
signature-members
unit-static-init-dependencies

top ← prev up next →

#### 7.12`` Transformer Helpers

(require racket/unit-exptime) | package: base

The racket/unit-exptime library provides procedures that are intended for use by macro transformers. In particular, the library is typically imported using for-syntax into a module that defines macro with define-syntax.

> > procedure
> > (unit-static-signatures |  | unit-identifier |
> > |  | err-syntax) |
> | → |  |
> (list/c (cons/c (or/c symbol? #f)
> identifier?))
> (list/c (cons/c (or/c symbol? #f)
> identifier?))
> unit-identifier : identifier?
> err-syntax : syntax?

If unit-identifier is bound to static unit information via define-unit (or other such forms), the result is two values. The first value is for the unit’s imports, and the second is for the unit’s exports. Each result value is a list, where each list element pairs a symbol or #f with an identifier. The symbol or #f indicates the import’s or export’s tag (where #f indicates no tag), and the identifier indicates the binding of the corresponding signature.

If unit-identifier is not bound to static unit information, then the exn:fail:syntax exception is raised. In that case, the given err-syntax argument is used as the source of the error, where unit-identifier is used as the detail source location.

> > procedure
> > (signature-members |  | sig-identifier |  |  |  |
> > |  | err-syntax) |  | → |  |
> > (or/c identifier? #f)
> > (listof identifier?)
> > (listof identifier?)
> > (listof identifier?)
> sig-identifier : identifier?
> err-syntax : syntax?

If sig-identifier is bound to static unit information via define-signature (or other such forms), the result is four values:

- an identifier or #f indicating the signature (of any) that is extended by the sig-identifier binding;

- a list of identifiers representing the variables supplied/required by the signature;

- a list of identifiers for variable definitions in the signature (i.e., variable bindings that are provided on import, but not defined by units that implement the signature); and

- a list of identifiers with syntax definitions in the signature.

Each of the result identifiers is given a lexical context that is based on sig-identifier, so the names are suitable for reference or binding in the context of sign-identifier.

If sig-identifier is not bound to a signature, then the exn:fail:syntax exception is raised. In that case, the given err-syntax argument is used as the source of the error, where sig-identifier is used as the detail source location.

> > procedure
> > (unit-static-init-dependencies |  | unit-identifier |
> > |  | err-syntax) |
> | → |  |
> (list/c (cons/c (or/c symbol? #f)
> identifier?))
> unit-identifier : identifier?
> err-syntax : syntax?

If unit-identifier is bound to static unit information via define-unit (or other such forms), the result is a list of pairs. Each pair combines a tag (or #f for no tag) and a signature name, indicating an initialization dependency of the unit on the specified import (i.e., the same tag and signature are included in the first result from unit-static-signatures).

If unit-identifier is not bound to static unit information, then the exn:fail:syntax exception is raised. In that case, the given err-syntax argument is used as the source of the error, where unit-identifier is used as the detail source location.

Added in version 6.1.1.8 of package base.

top ← prev up next →