I'm not familiar with how `ir-macro-transformer` is supposed to work, but
your macro is currently fails for essentially the same reason as:
(define-syntax (diverge stx)
  stx

The `expr` given to `test` is a syntactic list beginning with the
identifier `test`, so including it in the output triggers another expansion
of `test`, infinitely.

-Philip


On Wed, Aug 29, 2018 at 7:06 AM t791bc via Racket Users <
racket-users@googlegroups.com> wrote:

> Hi,
>
> while syntax-case has some advantages, I was trying to implement a Chicken
> style ir-macro-transformer in Racket so that I can write macros that will
> run both on Racket and systems like Chicken/Chibi Scheme.
>
> My first attempt was as follows:
>
> (begin-for-syntax
>   (require (for-syntax racket/base))
>   (define-syntax (ir-macro-transformer stx)
>     (syntax-case stx ()
>       [(_ ir-trans)
>         #'(lambda (x)
>             #`(ir-trans #,(syntax->datum x) 23))])))
>
> (define-syntax test
>   (ir-macro-transformer
>    (lambda (expr inject)
>        expr)))
>
> The result was "Background expansion terminated abnormally (out of
> memory)". If the #, is taken out I get an error that x is unbound. As
> should be obvious from the above,  I find it hard to reason about all those
> syntax effects - which only makes me want the ir-macro-transformer more
> despite all its shortcomings.
>
> Any help would be highly appreciated.
>
>
> --
> 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 racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to