[plt-scheme] 203.4

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Feb 12 12:18:22 EST 2003

The exp-tagged code in CVS for MzScheme and MrEd is now version 203.4.

This version finally corrects the handling of top-level and
module-top-level definitions when the defined identifier originates from
a macro expansion.


  (define-syntax def-and-use-of-x
    (syntax-rules ()
      [(def-and-use-of-x val)
       ; x below originates from this macro:
       (begin (define x val) x)]))

  (define x 1)
  x ; => 1
  (def-and-use-of-x 2) ; => 2
  x ; => 1

  (define-syntax def-and-use
    (syntax-rules ()
      [(def-and-use x val)
       ; x below was provided by the macro use:
       (begin (define x val) x)]))

  (def-and-use x 3) ; => 3
  x ; => 3

Within a module, `require' and `provide' similarly respect identifier
origins when introducing and referencing bindings. External names for
`provide' do not depend on an origin, though (for various reasons, but
mainly because the export would be useless). See the documentation for

Other changes, mostly related:

 * Added `make-syntax-introducer' for creating new macro origins
   on the fly.

 * Changed `generate-temporaries' so that it does not use `gensym', but
   instead uses `make-syntax-introducer' to distinguish names.

 * Fixed parse problems with # in numbers, so that `1#/2' is now parsed
   correctly, as well as my new favorite: `#e#x+e#s+e at -e#l-e'.

As a side note, I'm fairly certain that it's now possible to implement
versions of `let-syntax' and `letrec-syntax' that can be wrapped around
top-level definitions. I haven't actually tried, yet.


Posted on the users mailing list.