7.12 Transformer Helpers (original) (raw)

7.12 Transformer Helpers🔗

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.

If unit-identifier is bound to static unit information viadefine-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 givenerr-syntax argument is used as the source of the error, whereunit-identifier is used as the detail source location.

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

Each of the result identifiers is given lexical information that is based on sig-identifier, so the names are suitable for reference or binding in the context of sig-identifier. See define-signature for more information.

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

If unit-identifier is bound to static unit information viadefine-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 givenerr-syntax argument is used as the source of the error, whereunit-identifier is used as the detail source location.

Added in version 6.1.1.8 of package base.