> The new expander treats submodules like everything else. Since
> `racket/math`, is macro-introduced while the body of the submodule `pi`
> is not, the import doesn't bind `pi`. For that matter, the initial
> `racket/base` import is also macro-introduced and doesn't bind `#%top`
> for `pi`.

OK, this is the part I was missing: the old expander did a little magic with 
certain identifiers within submodules, but no longer.


> To make this example work with the new expander, one solution is to use
> `syntax/strip-context` to make a macro that behaves like
> `module*-macro` with the old expander, but with context stripping by
> the macro instead of by `module*`:

As an alternative, is it acceptable / wise to continue use `with-syntax` to 
introduce the identifiers that the new expander omits? E.g., this also will fix 
the macro:

(define-syntax (module*-macro stx)
  (syntax-case stx ()
    [(_ exprs ...)
     (with-syntax ([racket/base (format-id stx "~a" #'racket/base)])
       #'(module* submod-name racket/base 
         exprs ...))]))


> I think it's relatively common for macros that introduce submodules to
> intend non-hygienic binding for the macro body --- so, this is a
> significant incompatibility. I didn't see a way to keep the old
> behavior, though, without defeating some advantages of the new
> expander.


It sounds like the new expander doesn't forbid this kind of macrology, but 
rather requires the author to be more explicit about it.

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to