[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with with-syntax



I'm trying to make a macro that does some computation at expansion
time.  I defined a helper function at the top level, but when I call
it in a binding clause in with-syntax, MzScheme says it's undefined.
Here's a boiled-down version of the code:

  (define (id x) x)

  (define-syntax (foobar x)
    (syntax-case x ()
      ((_ expr)
       (with-syntax ((q (id (syntax expr))))
	 (syntax q)))))

  > (foobar 2)
  reference to undefined identifier: id

What environment is the "stx-expr" part of a with-syntax construct
evaluated in?  What's a better way to write this sort of thing?

(This is from v200alpha1, by the way.)

--dougo@ccs.neu.edu