#
Chapter 44
`stxparam.ss`: Syntax Parameters

To load: `(require (lib "stxparam.ss"))`

`(`define-syntax-parameter` `identifier expr`)` SYNTAX

Binds `identifier` as syntax to a syntax parameter. The `expr` is an expression in the transformer environment that serves as the default value for the syntax parameter.

The `identifier` can be used with `syntax-parameterize` or `syntax-parameter-value` (in a transformer). If `expr` produces a procedure of one argument or a `make-set!-transformer` result, then `identifier` can be used as a macro. If `expr` produces a `rename-transformer` result, then `identifier` can be used as a macro that expands to a use of the target identifier, but `syntax-local-value` of `identifier` does not produce the target's value.

`(`syntax-parameterize` `((identifier expr) `···`) body-expr `···`1`)` SYNTAX

Each `identifier` must be bound to a syntax parameter using `define-syntax-parameter`. Each `expr` is an expression in the transformer environment. During the expansion of the `body-expr`s, the value of each `expr` is bound to the corresponding `identifier`.

If an `expr` produces a procedure of one argument or a `make-set!-transformer` result, then its `identifier` can be used as a macro during the expansion of the `body-expr`s. If `expr` produces a `rename-transformer` result, then `identifier` can be used as a macro that expands to a use of the target identifier, but `syntax-local-value` of `identifier` does not produce the target's value.

`(syntax-parameter-value``` `id-stx``)` PROCEDURE

This procedure is intended for use in a transformer environment, where `id-stx` is an identifier bound in the normal environment to a syntax parameter. The result is the current value of the syntax parameter, as adjusted by `syntax-parameterize` form.

`(make-parameter-rename-transformer``` `id-stx``)` PROCEDURE

This procedure is intended for use in a transformer environment, where `id-stx` is an identifier bound in the normal environment to a syntax parameter. The result is transformer that behaves as `id-stx`, but that cannot be used with `syntax-parameterize` or `syntax-parameter-value`.

Using `make-parameter-rename-transformer` is analogous to defining a procedure that calls a parameter. Such a procedure can be exported to others to allow access to the parameter value, but not to change the parameter value. Similarly, `make-parameter-rename-transformer` allows a syntax parameter to used as a macro, but not changed.

The result of `make-parameter-rename-transformer` is not treated specially by `syntax-local-value`, unlike the result of MzScheme's `make-rename-transformer`.