[racket-dev] Identifier macros

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Dec 5 01:09:43 EST 2012

8 hours ago, Carl Eastlund wrote:
> I'm confused about so-called "identifier macros".  I had thought
> that ordinary transformers bound to functions could only transform
> application-position references to themselves, and that a "set!
> transformer" was required to transform bare references and set!
> references.  Turns out I was wrong, set!  transformers are in fact
> only required to transform set! references.  So why are they listed
> under the documentation for "identifier macros" and why does that
> documentation imply that normal transformers can't handle bare
> references?

Not an answer, but something that I always thought would be useful is
to expand the target in a `set!' expression.  I implemented this in
swindle, so you can do this:

  -> (define b (box 1))
  -> (defsubst v (unbox b))
  -> v
  1
  -> (set! v 10)
  -> (inc! v)
  -> v
  11
  -> b
  #&11

(`defsubst' is somewhat similar to an extended version of
`define-syntax-rule', and `inc!' is the obvious macro that is possible
with generalized CL-style setters.)

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


Posted on the dev mailing list.