guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help to understand a macro


From: Andreas Rottmann
Subject: Re: Need help to understand a macro
Date: Fri, 19 Mar 2010 17:15:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Andy Wingo <address@hidden> writes:

> Hi,
>
> On Fri 19 Mar 2010 09:57, Josef Wolf <address@hidden> writes:
>
>>  (show-expansion (defstruct tree height girth age leaf-shape leaf-color))
>
> (macroexpand '(defstruct ...))
>
> You might want to surround that with (pretty-print ...) from (ice-9
> pretty-print).
>
>> Of course this is possible. After all, code is data and data is code.
>
> Sorta. Syntax-rules/syntax-case macros operate on syntax objects, not on
> raw s-expressions. This allows them to preserve referential
> transparency. So the result of expansion might not look like what you
> would expect.
>
> Read up on syntax-rules and syntax-case macros, when you get some time.
> I used to love defmacros but I don't use them any more.
>
defmacros are bound to bite you in the proverbial ass real hard when you
combine them with modules, so it's best to avoid them like the
plague. At least that's my experience, FWIW.

Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]