Below, the two modules `test1` and `test2` use the same expander `exp` and 
otherwise differ only in the presence of the string "foo" as the second datum 
in `test2`. 

The syntax objects passed to #%module-begin are more different than that, 
however: the syntax passed to the first is 

#'(#%module-begin 'mac-result)

wheras the second gets: 

#'(#%module-begin (mac 42) "foo")

Thus my question: why is `mac` getting expanded at different times based on the 
presence of "foo"?


;;;
#lang racket

(module exp racket
  (provide #%datum mac (rename-out [mb #%module-begin]))

  (define-syntax-rule (mac x) 'mac-result)

  (define-syntax (mb stx)
    (println (syntax->datum stx))
    (syntax-case stx ()
      [(_ . EXPRS)
       #'(#%module-begin . EXPRS)])) )

(module test1 (submod ".." exp)
  (mac 42))
(require 'test1)
;; '(#%module-begin 'mac-result)

(module test2 (submod ".." exp)
  (mac 42) "foo")
(require 'test2)
;; '(#%module-begin (mac 42) "foo")

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/C0F76736-B28C-4F64-A1AA-D2B2EFD34BF8%40mbtype.com.

Reply via email to