[R6RS] Internal DEFINE vs. macros

Michael Sperber sperber
Fri Apr 15 04:17:30 EDT 2005


>>>>> "Matthew" == Matthew Flatt <mflatt at cs.utah.edu> writes:

Matthew> Just to double-check, we've established that this particular difference
Matthew> is only because of the splicing behavior of Chez's `let-syntax', right?

Yes, I think so.  We're back to the differences between my brain and
Chez/PLT. :-)

So,

(let-syntax ((foo (syntax-rules ()
		    ((foo) 'outer))))
  (let ()
    (define a (foo))
    (define-syntax foo
      (syntax-rules ()
	((foo) 'inner)))
    a))
=> inner

But:

(let-syntax ((foo (syntax-rules ()
		    ((foo ?x) (define ?x 'outer)))))
  (let ()
    (foo a)
    (define-syntax foo
      (syntax-rules ()
	((foo) (define ?x 'inner))))
    a))
=> outer

Now, 

(let-syntax ((foo (syntax-rules ()
		    ((foo ?x) (define ?x 'outer)))))
  (let ()
    (define-syntax foo
      (syntax-rules ()
	((foo) (define ?x 'inner))))
    (foo a)
    a))

produces outer on PLT, but on Chez says:

Error: invalid syntax (foo a).

Why?  (If you think I should wait until the full description of
SYNTAX-CASE is out let me know.)

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla


More information about the R6RS mailing list