17.15 Syntax Objects in Macros
function | |||||
| |||||
| |||||
function | |||||
| |||||
| |||||
function | |||||
|
Throws a syntax-error message concerning in_stx. If who is #false, it is inferred from in_stx. If message is not provided, the message is "bad syntax". If at_stx is provided, it should be something like an enclosed form of in_stx to provide extra context. Alternatively, at_stx can be a list of syntax objects, in which case all syntax objects provide extra contexts, least-specific to most-specific.
function | |||||
|
Returns the compile-time value of name, if available, in the space specified by in_space. If no compile-time value is available, then fail is called if it is a function of 0 arguments, otherwise fail is returned.
The default fail is a function that throws an exception.
function | |||||||
|
Checks whether stx1 at phase phase1 refers to the same binding as stx2 at phase2 within the space reflected by in_space.
function | |||||
|
Checks whether stx1 and stx2 have the same name (as returned by Syntax.unwrap on an identifier, for example) and the same scopes at phase.
When stx1 or stx2 is a dotted name, then both must be dotted names where each dotted component has the same name and scopes.
function | |||||
|
Returns a symbol that corresponds to the binding of stx in space in_space and at phase phase. The result does not uniquely identify a binding, but two names that refer to the same binding will have the same symbol result.
Returns a syntax object like stx, but where scopes indicating that the syntax object is macro-introduced are flipped. The result is stx unmodified when not during the expansion of a macro.
Macro-introduction is detected by flipping scopes to the input of a macro, then flipping scopes on the macro’s result, so that the two flip operations cancel for any part of the macro’s input that is used in the macro’s output.
A macro can flip introduction to implement a non-hygienic expansion for an introduced identifier, but generally Syntax.make_id is more reliable for this purpose, because there can be extra scopes that differentiate macro-definition and use sites. Flipping introduction may also be helpful when a syntax object from the macro’s input is preserved through side channels, so that the added scope is canceled, or in unusual cases when checking for the originalness of a term with Syntax.is_original.
Check whether the identifier #%dynamism using the scopes of stx is bound to indicate static mode. See use_static for more information.
function | |||||
|
Returns an identifier that has the same binding as name in space, and it also has a binding for #%dynamism to indicate dynamic or static mode, depending on as_static.
See use_static for more information about dynamic versus static mode.
annotation | |
Matches an integer or #false.
A phase-level integer corresponds to a phase of evaluation, especially relative to the main body of a module. Phase level 0 corresponds to a module’s run time, 1 corresponds to expansion time for run-time forms, and so on. A phase level of #false corresponds to the label phase, like meta_label.
function | |
Returns the phase of expression forms currently being expanded, or 0 if no expansion is in progress.
unquote binding | |
Unquote binding operator for use with $. It matches a syntax object for an identifier or operator, where the identifier or operator’s binding is the same as op_or_id_name in the SpaceMeta reflected by space_expr (e.g., expr_meta.space).