On Thu, May 5, 2011 at 4:08 AM, John Cowan
<cowan@mercury.ccil.org> wrote:
Andre van Tonder scripsit:
> (define-syntax my-syntax-rules
> (syntax-rules ()
> ((_ blah) (syntax-rules ..........)))
>
> (define-syntax foo (my-syntax-rules ........)) ;; PHASE ERROR
>
> This kind of thing would just work in some Scheme implementations, but
> others would require MY-SYNTAX-RULES to be imported FOR EXPAND for the
> macro definition of FOO to work.
Is it clear that it's required to work at all? IOW, is it clear that
macro calls are expanded in the body of a DEFINE-SYNTAX? Given the
following:
(define-syntax yow (syntax-rules () ((yow . bow) (syntax-rules . bow))))
(define-syntax cow (yow () ((cow) 32)))
MIT Scheme, Guile, Kawa, SISC, Chibi, Chez, SCM, Ikarus, IronScheme,
Mosh all accept both lines and (cow) => 32. But Racket, Gauche,
Chicken, Scheme48/scsh, Larceny, Ypsilon, STklos, Scheme 9 all complain
about bad syntax or undefined variables in the second line.
Ah, yes, the spec (R7-draft) already says the right hand side define-syntax, let-syntax, letrec-syntax must be "an instance of syntax-rules", and therefore may not be an invocation of a user-defined macro. And syntax-rules also is not "powerful-enough" to invoke a user-defined macro during its expansion (as syntax-case is). Therefore, there are no phase issues in WG1.