Opened 8 years ago
Closed 8 years ago
#1306 closed defect (invalid)
The body of a syntax definer should be allowed to be a macro call
Reported by: | johnwcowan | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | someday |
Component: | unknown | Version: | 4.11.0 |
Keywords: | Cc: | ||
Estimated difficulty: |
Description
Currently Chicken doesn't support things like this:
(define (baz) 32) (define-syntax foo (syntax-rules () ((foo) (syntax-rules () ((bar) (baz))))))) (define-syntax quux (foo)) ; fails with "foo not defined"
On most Schemes that support macro varieties other than syntax-rules (and therefore extend R5RS in this situation), macro calls are expanded in this position, and (quux)
evaluates to 32. However, on Chicken they aren't. They should be.
Note: See
TracTickets for help on using
tickets.
I believe this to be incorrect: you are mixing phases. The definition of
foo
defines a macro that needs to be available when definingquux
, which is syntax, so it needs to be defined in a higher/earlier phase (what's the correct term for this?) thanquux
.This works when you wrap the definition of
foo
in abegin-for-syntax
, or if you put it in a separate module and import it for syntax: