12.13 Phase and Space Utilities (original) (raw)
12.13 Phase and Space Utilities🔗ℹ
The racket/phase+space library provides functions for manipulating combined representations of phase levels andbinding spaces, particularly as used for require transformers and provide transformers.
When identifier-binding (and related functions, likeidentifier-transformer-binding),syntax-local-module-exports,syntax-local-module-required-identifiers,module-compiled-exports, or module->exports produces a phase–space combination (or phase–space shift combination), then two such values that are equal? will be eqv?.
Added in version 8.2.0.3 of package base.
Returns #t if v is a valid representation of aphase level, #f otherwise. A valid representation is either an exact integer representing a numbered phase level or #f representing the label phase level.
Returns #t if v is a valid representation of abinding space, #f otherwise. A valid representation is either an interned symbol representing the space whose scope is accessed via make-interned-syntax-introducer, or#f representing the default binding space.
Returns #t if v is a valid representation of aphase level and binding space combination,#f otherwise. The possible representations are as follows:
- a phase (in the sense of phase?) by itself, which represents that phase plus the default binding space
- a pair whose car is a phase and whose cdr is a non-#f space (in the sense of space?)
(phase+space phase space) → phase+space? phase : phase? space : space?
Returns a value to represent the combination of phase andspace.
Returns #t if v is a valid representation of aphase level shift and binding space shift combination,#f otherwise. A shift can be applied to a combination of a phase level and binding space using phase+shift+. The possible representations of a shift are as follows:
- exact integer — represents an amount to shift a phase level and no change to the binding space
- #f — represents a shift to the label phase level and no change to the binding space
- a pair whose car is an exact integer or #f, and whose cdr is a space (in the sense ofspace?) — represents a phase level shift in thecar and a change to the binding space that is in thecdr
(phase+space+ p+s shift) → phase+space? p+s : phase+space? shift : phase+space-shift?
(phase+space-shift+ shift additional-shift) → phase+space-shift? shift : phase+space? additional-shift : phase+space-shift?
Composes shift and additional-shift to produce a new shift that behaves the same as applying shift followed byadditional-shift.