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

From: Arjun Guha (garjun at cs.brown.edu)
Date: Sun Jun 5 23:00:20 EDT 2005

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.