>> A macro that wants to put identifiers in a binding position MUST produce the 
>> whole binding form for those identifiers.
> 
> Well, that's pretty much what match expanders are. Although the `match` forms 
> have to recognize these match expanders specially, and expand them itself, 
> one step at a time.

That's why I think of `match` as special: it has its own means of extending its 
interface, namely with match expanders. 

What I'm curious about is the more general situation of composing macros that 
hold identifiers.


> I was about to try to apply its awesome power to your example, but I just 
> realized that in your new example, the s-expression `(id-maker a ZIM b ZAM 
> c)` isn't actually used in a binding position. Instead the individual ids 
> within it are used in binding positions. 

Perhaps I'm misusing the term "binding position". I understand it as "the place 
where the identifiers sit so they'll get bound". So x and y are in binding 
positions here:

(define x 42)

(let ([y 42])
  y)

And in my sample binding macro:

(define-syntax-rule (binding-form _topid (_id ...))
  (define (_topid)
    (let ([_id '_id] ...)
      (displayln (format "~a bound ~a" '_topid _id)) ...)))

whatever `(id ...)`s are in the second argument will be bound (within `let`) so 
the second argument position is impliedly a binding position. Wrong?


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to