On Jun 14, 8:21 pm, rvirding <
rvird...@gmail.com> wrote:
> One thing that is difficult and limited with macros as they are today
> is trying to explicitly do macro expansion inside a macro. While it is
> easy to call the macro expansion functions in lfe_macro there is no
> way to access the current macro environment which means you can only
> use the built-in predefined macros.
Sorry for the late reply, I missed this message when it first was
posted.
Do you mean, for example, calling a function like 'macroexpand-all'
and expanding all macros and walking the resulting tree? Or do you
mean simply using macros inside the body of other macros? Both can be
problematic IIRC. The second would be very useful.
> A serious limitation. I found this
> for myself when trying to write macros for match specifications and
> query list comprehensions (which soon both be testable).
>
> I have a suggestion how to solve this. In the macro body there will be
> a predefined variable which is bound to the environment, $ENV perhaps,
> which can be used when explicitly calling the macro expansion
> functions. There is a problem of how to handle this if macrolet is
> used in the macro body but it might not be serious. Does anyone use
> macrolet? Get rid of macrolet?
>
The $ENV idea sounds good. Not sure why you would have to remove
macrolet, however. Wouldn't it just be temporarily adding the macro-
function to the $ENV variable? (or it could be done a different way).
It might have to be some sort of specially handled form I suppose.