[plt-scheme] module question

From: jos.koot at tiscali.nl (jos.koot at tiscali.nl)
Date: Mon May 29 05:02:29 EDT 2006

Hi, The difference between the following two pieces of code puzzles me:

(define-syntax a (syntax-rules () ((a) 'a)))
(module b mzscheme
    (provide b)
    (define-syntax b (syntax-rules () ((b) (a)))))
(require b)
(b) ; --> a


(module a mzscheme
    (provide a)
    (define-syntax a (syntax-rules () ((a) 'a))))
(require a)
(module b mzscheme
    (provide b)
    (define-syntax b (syntax-rules () ((b) (a)))))
(require b)
(b) ; error: reference to undefined identifier: a ---> arrow to 
identifier a 
in module b

Of course the problem does not arise if in the second example module 
includes (require a), which it should, I think. Nevertheless the 
puzzles me. Can you explain this?  I did this with Textual MzScheme 

((((lambda(x)((((((x x)x)x)x)x)x))
   (lambda(x)(lambda(y)(x(x y)))))
  (lambda(x)(write x)x))
 "greetings, Jos")

Posted on the users mailing list.