11.3 Syntax Object Bindings
Returns
#t if the identifier
a-id would bind
b-id (or vice versa) if the identifiers were substituted in a
suitable expression context at the
phase level indicated by
phase-level,
#f otherwise. A
#f value for
phase-level corresponds to the
label phase level.
Examples: |
| | > (check a a) | 'binds | > (check a b) | 'no-binds | > (define-syntax-rule (check-a x) (check a x)) | | > (check-a a) | 'no-binds |
|
“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.
Examples: |
| | > (check car) | '(same: #<procedure:car>) | > (check mcar) | '(different: #<procedure:mcar>) | | '(different: #<procedure:list>) | > (require (rename-in racket/base [car kar])) | | > (check kar) | '(same: #<procedure:car>) |
|
Compares each identifier in
ids with every other identifier
in the list with
bound-identifier=?. If any comparison
returns
#t, one of the duplicate identifiers is returned (the
first one in
ids that is a duplicate), otherwise the result
is
#f.
Returns one of three kinds of values, depending on the binding of
id-stx at the
phase level indicated by
phase-level (where a
#f value for
phase-level corresponds to the
label phase level):
The result is 'lexical if id-stx
has a local binding. If 'lexical is produced for
any phase-level value, then it is produced for all
phase-level values.
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
same.
source-phase is 1 if the source
definition is for-syntax, 0 otherwise.
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 #f if id-stx has a
top-level binding (or, equivalently, if it is
unbound).
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
free-identifier=?.