Hi Neil,
>> 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. > > Can you give an example? Well, in R6RS, the body of `define-syntax' forms is evaluated in a higher "phase" -- meaning that there are additional bindings visible while it's being evaluated. I'm using a dynamically-created module as the evaluation environment, and I've grouped the phased bindings into modules that can be temporarily added to the dynamic module's "uses" list. So my custom `define-syntax' would look something like: (inject-modules-for-phase (current-module) (get-modules-for-phase current-phase)) (canonical-define-syntax keyw expr) (remove-injected-modules (current-module)) The rationale is that having the modules containing the phased bindings in the uses list will make them visible in the closures used by syncase -- which, with Andy's syncase hygiene changes in place, will lead to the module-relative `@' forms being produced in the expansion. (I had a naive version working earlier -- which I attached to a message to guile-devel -- that wasn't aware of lexical scope, and I'm trying to rewrite it to rely more on Guile's evaluator.) > Hmm. I don't really have much idea... but given that define-syntax is > syntax, does (define-syntax canonical-define-syntax define-syntax) > work any better? Nope: ERROR: invalid syntax define-syntax > Also does it make any difference if you use use-syntax instead of > use-modules ? Nope, doesn't seem to have any effect. Regards, Julian