[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
wrapping `define-syntax'
From: |
Julian Graham |
Subject: |
wrapping `define-syntax' |
Date: |
Sun, 12 Apr 2009 18:55:22 -0400 |
Hi Guilers,
For the purpose of some experiments I've been doing with integrating
R6RS libraries, I've been trying to figure out ways to wrap
`define-syntax' so that I can do things like add bindings to a
module's eval closure before evaluating a macro definition. As part
of this mechanism, I need to be able to save the original transformer
for `define-syntax' so that I can delegate to it. When I run the
following code (either in master or Andy Wingo's "syncase" branch)...
(use-modules (ice-9 syncase))
(define canonical-define-syntax (@ (ice-9 syncase) define-syntax))
(canonical-define-syntax foo (syntax-rules () ((_) 'foo)))
...I get:
ERROR: In procedure vm-run:
ERROR: VM: Stack overflow
I've also tried doing:
(define canonical-define-syntax
(procedure->memoizing-macro (macro-transformer (@ (ice-9 syncase)
define-syntax))))
...which produces, when I try to use it:
ERROR: unknown kind of macro
So I'm curious: regardless of whether what I'm trying to do is a good
idea, is it feasible -- and if so, what's the right way to do it?
Regards,
Julian