Formal comment #60 (defect) Declarations break lexical scoping Reported by: Andre van Tonder Component: other Version: 5.91 Component : Bodies and sequences (9.4) and Expansion process (8) Pages : 28, 29 and 30 Summary Expansion process as currently described violates lexical scoping for bodies with "declare" forms. Description Consider Example 1: (let () (declare safe) (define declare 1)) Example 2: (let () (declare safe) (define safe 1)) According to the algorithm in the first paragraph of p.28, it appears that the first line in both examples should be accepted as a declaration. This is in conflict with lexical scoping according to the second paragraph of p.30, which says that "the region of the binding is the entire
" Suggestion I see two options: Option 1: Example 1 (but not example 2) can be fixed by changing the line on p 28: "To detect this error, the expander records the identifying keyword for each macro use, define-syntax form, define form, begin form, let-syntax form, and letrec-syntax form it encounters while processing the definitions ..." --> "To detect this error, the expander records the identifying keyword for each macro use, [[declare form]], define-syntax form, define form, begin form, let-syntax form, and letrec-syntax form it encounters while processing the [[declarations and]] definitions ..." Example 2 could be "fixed" by requiring declarations'