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

Re: Namespaces

This page is part of the web mail archives of SRFI 72 from before July 7th, 2015. The new archives for SRFI 72 contain all messages, not just those from before July 7th, 2015.



On Sun, 14 Aug 2005, Martin Gasbichler wrote:

Andre van Tonder <andre@xxxxxxxxxxxxxxxxx> writes:

I have been wondering about the following technical issue:

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

...

I don't think this has anything to do with namespaces. The variable
generated by (syntax x) and the binding introduced by the LET live in
different phases (or stages). Hence they must not interfere.

The syntax-case model is like an interpreter whose source code
bindings interact with the variables of the interpreted program.

I'm inclined to agree, even if doing this entails a break with the traditional model. It seems like the right thing but may be somewhat hairy to implement, though. For example, presumably the following:

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

should give 1. For each identifier, the expander needs to keep track of its binding at all different levels of the syntactic tower.

Cheers
Andre