11.3 Syntax Object Bindings
(bound-identifier=? a-id b-id [phase-level]) → boolean? | ||||||||||||
a-id : syntax? | ||||||||||||
b-id : syntax? | ||||||||||||
|
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.
(free-identifier=? a-id b-id [phase-level]) → boolean? | ||||||||||||
a-id : syntax? | ||||||||||||
b-id : syntax? | ||||||||||||
|
Returns #t if a-id and b-id access the same lexical, module, or top-level binding at the phase level indicated by phase-level. A #f value for phase-level corresponds to the label phase level.
“Same module binding” means that the identifiers refer to the same original definition site, not necessarily the require or provide site. Due to renaming in require and provide, the identifiers may return distinct results with syntax-e.
(free-transformer-identifier=? a-id b-id) → boolean? |
a-id : syntax? |
b-id : syntax? |
Same as (free-identifier=? a-id b-id (add1 (syntax-local-phase-level))).
(free-template-identifier=? a-id b-id) → boolean? |
a-id : syntax? |
b-id : syntax? |
Same as (free-identifier=? a-id b-id (sub1 (syntax-local-phase-level))).
(free-label-identifier=? a-id b-id) → boolean? |
a-id : syntax? |
b-id : syntax? |
Same as (free-identifier=? a-id b-id #f).
(check-duplicate-identifier ids) → (or/c identifier? false/c) |
ids : (listof identifier?) |
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.
(identifier-binding id-stx [phase-level]) | ||||||||||||
| ||||||||||||
id-stx : syntax? | ||||||||||||
|
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 six 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.
(identifier-transformer-binding id-stx) | ||||||||||||
| ||||||||||||
id-stx : syntax? |
Same as (identifier-binding id-stx (add1 (syntax-local-phase-level))).
(identifier-template-binding id-stx) | ||||||||||||
| ||||||||||||
id-stx : syntax? |
Same as (identifier-binding id-stx (sub1 (syntax-local-phase-level))).
(identifier-label-binding id-stx) | ||||||||||||
| ||||||||||||
id-stx : syntax? |
Same as (identifier-binding id-stx #f).