Next: expander lexenv synonyms, Previous: expander lexenv internal, Up: expander lexenv [Index]
When a fluid syntax’s syntactic binding is established by
define-fluid-syntax in the source code of a library or program:
(define-fluid-syntax ?lhs ?rhs)
an identifier ?lhs is associated to a main label ?label in
the current rib; an entry is pushed on the LEXENV:
(?label . ($fluid . ?fluid-label))
when querying the LEXENV for the binding descriptor associated to
?label: the descriptor with type $fluid is always returned,
qualifying the binding as fluid syntax.
At the same time, define-fluid-syntax pushes another entry on
the LEXENV:
(?fluid-label . ?syntactic-binding)
where ?syntactic-binding is the concrete binding descriptor created by expanding and evaluating ?rhs then interpreting its return value.
Given the identifier ?lhs: we can retrieve the associated ?label and so the ?fluid-label; then we can “follow through” ?fluid-label to retrieve the actual binding descriptor.
The fluid syntax can be redefined any number of times by using
fluid-let-syntax:
(fluid-let-syntax ((?lhs ?inner-rhs)) . ?body)
causing other entries associated to ?fluid-label to be pushed on the LEXENV:
(?fluid-label . ?inner-syntactic-binding)
where ?inner-syntactic-binding is the binding descriptor resulting from expanding and evaluating ?inner-rhs then interpreting its return value.
When searching the LEXENV for a syntactic binding descriptor matching the label ?fluid-label: the topmost entry is found, so the binding appears to be redefined.
This is not what happens for the primitive fluid syntaxes
exported by the boot image like return, break and
continue. For these syntaxes the lexical environment of the
boot image includes only the entries:
(?return-label . ($fluid . ?return-fluid-label)) (?break-label . ($fluid . ?break-fluid-label)) (?continue-label . ($fluid . ?continue-fluid-label))
and there are no entries for the fluid labels ?return-fluid-label, ?break-fluid-label and ?continue-fluid-label. The keywords of these fluid syntaxes are bound in the environment, but they are bound to “nothing”; trying to follow through the fluid labels to the concrete binding descriptors will result in the binding descriptor:
(displaced-lexical . #f)
which is interpreted as the error “keyword identifier out of context”.
Such half–defined fluid syntaxes are fully usable as auxiliary syntaxes
and can be redefined with fluid-let-syntax. There are
no transformer functions for return, break,
continue and similar syntaxes.
Next: expander lexenv synonyms, Previous: expander lexenv internal, Up: expander lexenv [Index]