11.3 Syntax Object Bindings
procedure
(bound-identifier=? a-id b-id [phase-level]) → boolean?
a-id : syntax? b-id : syntax?
phase-level : (or/c exact-integer? #f) = (syntax-local-phase-level)
Examples: | ||||||||||||||||||
|
procedure
(free-identifier=? a-id b-id [ a-phase-level b-phase-level]) → boolean? a-id : syntax? b-id : syntax?
a-phase-level : (or/c exact-integer? #f) = (syntax-local-phase-level) b-phase-level : (or/c exact-integer? #f) = a-phase-level
“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: | ||||||||||||||||||||||
|
procedure
(free-transformer-identifier=? a-id b-id) → boolean?
a-id : syntax? b-id : syntax?
procedure
(free-template-identifier=? a-id b-id) → boolean?
a-id : syntax? b-id : syntax?
procedure
(free-label-identifier=? a-id b-id) → boolean?
a-id : syntax? b-id : syntax?
procedure
(check-duplicate-identifier ids) → (or/c identifier? #f)
ids : (listof identifier?)
procedure
(identifier-binding id-stx [phase-level])
→
(or/c 'lexical #f (listof module-path-index? symbol? module-path-index? symbol? (or/c 0 1) (or/c exact-integer? #f) (or/c exact-integer? #f))) id-stx : syntax?
phase-level : (or/c exact-integer? #f) = (syntax-local-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=?.
procedure
(identifier-transformer-binding id-stx)
→
(or/c 'lexical #f (listof module-path-index? symbol? module-path-index? symbol? (or/c 0 1) (or/c exact-integer? #f) (or/c exact-integer? #f))) id-stx : syntax?
procedure
(identifier-template-binding id-stx)
→
(or/c 'lexical #f (listof module-path-index? symbol? module-path-index? symbol? (or/c 0 1) (or/c exact-integer? #f) (or/c exact-integer? #f))) id-stx : syntax?
procedure
(identifier-label-binding id-stx)
→
(or/c 'lexical #f (listof module-path-index? symbol? module-path-index? symbol? (or/c 0 1) (or/c exact-integer? #f) (or/c exact-integer? #f))) id-stx : syntax?