Email list hosting service & mailing list manager


Re: Namespaces Andre van Tonder 16 Aug 2005 16:33 UTC

On Tue, 16 Aug 2005, Matthias Neubauer wrote:

> ..., the result still is 2! That's the point! Andre seemed to suggest
> at the beginning of this thread that either 1 or "no result" would be
> sensible results for this example. I think returning "1" is the wrong
> thing here, because this seems to contradict lexical scoping
> completely.

I would agree with this if (syntax x) were a variable in the meta-language used
in the body of the macro m in:

  (let ((x 1))
    (let-syntax ((m (lambda (form)
                      (let ((x 2))
                        (syntax x)))))
      (m)))

but it is not a variable, since it is quoted in the meta-language, so I don't
see a conflict in principle with lexical scoping if the inner x does not bind
it.

A possible scoping rule would be that the denotation of a syntax-quoted variable
be determined by enclosing bindings in the basement-level language outside the
body of the macro itself.   This is still lexical scoping, since it still
allows one to determine the meaning of the identifier from the lexical context
of its use.

Cheers
Andre