3.21 Syntax Quoting: quote-syntax (original) (raw)
3.21 Syntax Quoting: quote-syntax🔗ℹ
(quote-syntax datum) (quote-syntax datum #:local)
Similar to quote, but produces a syntax objectthat preserves the lexical information and source-location information attached to datum at expansion time.
When #:local is specified, then all scopes in the syntax object’s lexical information are preserved. When#:local is omitted, then the scope sets withindatum are pruned to omit the scope for any binding form that appears between the quote-syntax form and the enclosing top-level context, module body, or phase levelcrossing, whichever is closer.
Unlike syntax (#'), quote-syntax does not substitute pattern variables bound by with-syntax,syntax-parse, or syntax-case.
Examples:
> (syntax? (quote-syntax x)) #t > (quote-syntax (1 2 3)) #<syntax:eval:78:0 (1 2 3)> #<syntax:eval:79:0 (a b c)> #t #f
Changed in version 6.3 of package base: Added scope pruning and support for #:local.