[plt-scheme] make-set!-transformer baffling me...

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Jan 28 17:13:53 EST 2007

On Jan 26, Jay Kint wrote:
> > But still, I think that you're going in the wrong direction.
> > Providing a simple binding for `*features*' is not difficult, and
> > the common idiom is to define it as a parameter (which you can
> > wrap with some syntactic sugar to make it look like a settable
> > identifier) which plays nicely with threads.  Like I said in a
> > previous post -- this will actually make two separate values when
> > used in run-time code and in macro code.  But if you really want
> > the CL thing, then you'll probably end up trying to make:
> >
> >   #+foo ...
> >
> > work if 'foo is in `*features*'.  Implementing a `#+' reader macro
> > will naturally introduce yet another level, with a third instance
> > of the parameter, disconnected from the other two...
> What I did was define a (cond-expand feature form) syntax that checks
> the *features* (defined for syntax) variable for the feature and
> either returns the form or returns (void).  The reader macro #+ just
> returns a corresponding cond-expand.  So far, so good from my limited
> testing.

You shouldn't mix the two facilities.  The CL #+ thing works at the
reader level, so you can do stuff like:

  (define (foo x #+feature y)

> The only caveat seems to be that each module that requires
> feature-expressions.ss gets its own set of features,

The main point to remember is that MzScheme is forcing code to work
the same even when you do separate compilation.  So it's generally bad
to try to have side effects in one syntax level have an effect on

> and there has to be a top level (require (lib
> "features-expressions.ss")) to install the reader macros.

You should use #reader instead of changing the global readtable
through a side effect.

> Both of these are fairly easy to work around though.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.