[plt-scheme] macro keyword conflicting with other imports?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Nov 10 16:18:43 EST 2004

At Wed, 10 Nov 2004 14:34:14 -0600, ian barland (penguin flight instructor) wrote:
> (module my-macros mzscheme
>   (provide run)
>   ; A straightforward macro, expecting a keyword "fun":
>   ;
>   (define-syntax run
>     (syntax-rules (fun)
>       [(run fun n)
>        (format "It's fun to run ~v." n)]))
>   )

The `fun' literal above matches identifiers with the same binding for
`fun' as the context of the literal. In this case, there is no

> (module some-lib mzscheme
>   (provide fun)
>   (define (fun) 'whee))
> (require some-lib)
> (run fun 8)    ; Unexpectedly (to me), => Error: run: bad syntax

Here, the binding for `fun' is from `some-lib'. So it doesn't match the
pattern, which matches only a `fun' with no binding.


Posted on the users mailing list.