Marc raised this issue in 2016:
<
https://groups.google.com/g/scheme-reports-wg1/c/sMNF8k0h3So/m/za3TtykeEAAJ>
Since this is apparently ambiguous, I was intending to not support (library …) in cond-expand outside of import declarations in my WIP implementation.
But today I noticed that there is a sample implementation of cond-expand in terms of ‘syntax-rules’ in section 7.3. (Derived expression types) which lists ‘library’ as a pattern literal, meaning it is matched by free-identifier=?, meaning ‘library’ has to be bound to something for it to work properly.
I realize that even by the standards of the sample implementations in 7.3, the cond-expand sample implementation is impractical. Nonetheless it is part of the normative text of the standard. Much as in the case of identifiers as field names in define-record-type, identifier matching is thus the only semantic that makes sense when the entire report is read in context. Thus ‘library’ must be exported from somewhere, and (scheme base) must be the place to do it.
(‘r7rs’ and ‘scheme’ and ‘base’ are also considered pattern literals by that implementation, but this seems to me to be a result of shoehorning in the fundamentally un-syntax-rules-able cond-expand into cond-expand, a truly Procrustean effort.)
Daphne