[plt-scheme] Re: (module ...) vs. Textual (so to speak)

From: Guillaume Marceau (gmarceau at cs.brown.edu)
Date: Sun Jun 5 23:40:03 EDT 2005

It's a feature, although a rather odd one.

Try this:

> (require (rename (lib "contract.ss") surprise listof))
> (require strange)
> (funky (surprise (surprise b)))
b
> 

Then read about syntax-case* and module-identifer=

On Sun, 2005-06-05 at 23:00 -0400, Arjun Guha wrote:
> Consider the following module:
> 
> (module strange mzscheme
>   (require (lib "contract.ss"))
> 
>   (provide funky)
>   (define-syntax (funky stx)
>     (syntax-case stx (listof)
>       [(_ (listof value)) #'(funky value)]
>       [(_ id) (identifier? #'id) #'(quote id)]))
> 
>   (provide foo)
>   (define foo (funky (listof a)))
>   )
> 
> Note that we do not use anything from contract.ss, but the funky macro
> uses listof as a keyword, which is syntax exported from contract.ss.
> 
> Now, if we load the module using the (module ...) language in DrScheme, we
> can successfully evaluate:
> 
> > (funky (listof a))
> a
> > (funky (listof (listof b)))
> b
> 
> Also note that foo, exported by the module, correctly evaluates to a.
> 
> Now, using the Textual language level, if we try the same stuff in the
> REPL:
> 
> Welcome to DrScheme, version 299.103-cvs28apr2005.
> Language: Textual (MzScheme, includes R5RS).
> > (require "strange.ss")
> > foo
> a
> > (funky (listof a))
> funky: bad syntax in: (funky (listof a))
> 
> It is a conflict with contract.ss, because if we don't import it (or
> import all-except listof), we don't have this problem.  However, in either
> case foo evaluates correctly.
> 
> Bug or feature?
> 
> -Arjun
> 
-- 



Posted on the users mailing list.