[plt-scheme] Unit/sig and hygiene
[Sorry for the delay...]
At Thu, 28 Sep 2006 10:54:36 +0100, Dave Gurnell wrote:
> We have a problem with the interaction between signed units and
> hygiene.
I don't think your problem has anything to do with units. It has to do
with `syntax-local-introduce' and modules:
> (define-syntax (define-snooze-interface stx)
> (syntax-case stx ()
> [(define-snooze-interface db@)
> (syntax-local-introduce
> #'(begin
> [...]
Here's a simpler program with the same problem:
(module ma mzscheme
(define-syntax (def-a stx)
(syntax-case stx ()
[(_)
(syntax-local-introduce
#'(begin
(define a 5)
(define-syntax get-a
(syntax-rules ()
[(_) a]))
(provide get-a)))]))
(provide def-a))
(module mb mzscheme
(require ma)
(def-a)
(printf "~a\n" (get-a)))
I think the problem is best characterized as a bug in MzScheme's
handling of module-top-level bindings. MzScheme's expander doesn't
introduce a suitable of renaming for `a', because the defined `a'
appears not to come from a macro (since the macro uses
`syntax-local-introduce' to hide the introduction).
I'll look into fixing it, but I'll have to think more about whether
syntax-local-introduce' can cause other, similar problems. Meanwhile, I
recommend trying to use `datum->syntax-object' instead of
`syntax-local-introduce'.
Matthew