12.6 Local Binding with Splicing Body
Like
let,
letrec,
let-values,
letrec-values,
let-syntax,
letrec-syntax,
let-syntaxes,
letrec-syntaxes,
letrec-syntaxes+values, and
local, except that in a
definition context, the body forms are spliced into the enclosing
definition context (in the same way as for
begin).
Examples:
|
|
> o |
1 |
> one |
one: undefined; |
cannot reference undefined identifier |
When a splicing binding form occurs in a top-level context or
module context, its local bindings are treated similarly to
definitions. In particular, syntax bindings are
evaluated every time the module is visited, instead of only
once during compilation as in let-syntax, etc.
Example:
|
bad.0: undefined; |
cannot reference undefined identifier |
If a definition within a splicing form is intended to be local to the
splicing body, then the identifier should have a true value for the
'definition-intended-as-local syntax property. For
example, splicing-let itself adds the property to
locally-bound identifiers as it expands to a sequence of definitions,
so that nesting splicing-let within a splicing form works as
expected (without any ambiguous bindings).
Note that require transformers and provide transformers are not
affected by syntax parameterization. While all uses of require and
provide will be spliced into the enclosing context, derived import or
export specifications will expand as if they had not been inside of the
splicing-syntax-parameterize.
Examples: