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

(define <generated> ...)




Well now, we're just all too complacent here on this list.

I have a little question about define-syntax.  What's the following
program supposed to do?


    (define foo 20)

    (define-syntax defoo
      (syntax-rules ()
	((defoo name)
	 (begin (define foo 30)
		(define name (+ foo 4))))))

    (defoo x)

    foo  =>  20 or 30 ?


Of course, X will be 34 in either case.  But what I want to know is
whether the identifier that gets defined by the macro's (define foo
...) is the generated identifier (alias) or FOO.

I just tried this in two different implementations and got 30 in both,
but I'm not so sure that I should have.  After all, the macro's
definition of FOO is a "binding inserted by the macro," isn't it?

Oh, I forgot, DEFINE's for top-level variables might or might not
introduce bindings, so maybe this is implementation-dependent?

Jonathan