12.3 Syntax Object Bindings
if the identifier a-id
(or vice versa) if the identifiers were substituted in a
suitable expression context at the phase level
otherwise. A #f
corresponds to the label phase level
|> (check a a)|
|> (check a b)|
|> (define-syntax-rule (check-a x) (check a x))|
|> (check-a a)|
“Same module binding” means that the identifiers refer to the same
original definition site, and not necessarily to the same
require or provide site. Due to renaming in
require and provide, or due to a transformer binding
to a rename transformer, the identifiers may return distinct
results with syntax-e.
|> (check car)|
|> (check mcar)|
|> (require (rename-in racket/base [car kar]))|
|> (check kar)|
Compares each identifier in ids
with every other identifier
in the list with bound-identifier=?
. If any comparison
, one of the duplicate identifiers is returned (the
first one in ids
that is a duplicate), otherwise the result
Returns one of three (if top-level-symbol?
or four (if top-level-symbol?
is true) kinds of values, depending on the binding of
at the phase level
(where a #f
corresponds to the label phase level
The result is 'lexical if id-stx
has a local binding.
The result is a list of seven items when id-stx
has a module binding: (list source-mod source-id nominal-source-mod nominal-source-id source-phase import-phase nominal-export-phase).
source-mod is a module path index (see
Compiled Modules and References) that indicates the defining module.
source-id is a symbol for the identifier’s name
at its definition site in the source module. This can be
different from the local name returned by
syntax->datum for several reasons: the identifier is
renamed on import, it is renamed on export, or it is
implicitly renamed because the identifier (or its import) was
generated by a macro invocation.
nominal-source-mod is a module path index (see
Compiled Modules and References) that indicates the module
required into the context of id-stx to
provide its binding. It can be different from
source-mod due to a re-export in
nominal-source-mod of some imported identifier. If
the same binding is imported in multiple ways, an arbitrary
representative is chosen.
nominal-source-id is a symbol for the
identifier’s name as exported by
nominal-source-mod. It can be different from
source-id due to a renaming provide, even if
source-mod and nominal-source-mod are the
source-phase is an exact non-negative integer
representing the source phase. For example, it is 1 if the source
definition is for-syntax.
import-phase is 0 if the binding
import of nominal-source-mode is a plain
require, 1 if it is from a
for-syntax import, etc.
nominal-export-phase is the phase level
of the export from nominal-source-mod.
The result is (list source-id) if id-stx has a
top-level binding and top-level-symbol? is true.
The result is #f if id-stx has a
top-level binding and top-level-symbol? is
#f or if id-stx is unbound. An
unbound identifier is typically treated the same as an
identifier whose top-level binding is a variable.
If id-stx is bound to a rename-transformer, the result
from identifier-binding is for the identifier in the
transformer, so that identifier-binding is consistent with
Changed in version 126.96.36.199 of package base: Added the top-level-symbol? argument to report
information on top-level bindings.
, but produces a symbol that
corresponds to the binding. The symbol result is the same for any
identifiers that are free-identifier=?
, but the result may
also be the same for identifiers that are not
(i.e., different symbols imply different
bindings, but the same symbol does not imply the same binding).
When identifier-binding would produce a list, then the second
element of that list is the result that