[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Expanding macros
From: |
Panicz Maciej Godek |
Subject: |
Re: Expanding macros |
Date: |
Fri, 28 Sep 2012 17:52:19 +0200 |
Bonjour,
> There’s the ,expand command at the REPL.
>
> It’s implemented like this:
>
> (define (repl-expand repl form)
> (let ((from (repl-language repl))
> (opts (repl-compile-options repl)))
> (decompile (compile form #:from from #:to 'tree-il #:opts opts
> #:env (current-module))
> #:from 'tree-il #:to from)))
>
> Psyntax, the macro expander, returns tree-il, hence the need to go
> through ‘decompile’.
Thanks a lot. By the way, the (undocumented, as of 2.0.5) decompile
function returns two values -- the first being the expanded expression
and the second -- #f.
As I've figured out from system/base/compile, the second return value
is the environment, but I've been wondering under what circumstances
would that value be different from #f.
Best regards
MG