help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Understanding macros and the compilation flow


From: Helmut Eller
Subject: Re: Understanding macros and the compilation flow
Date: Wed, 08 Dec 2010 15:11:28 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

* LanX [2010-06-03 17:03+0200] writes:

> Hi
>
> I've put the following code into *scratch* and did M-x eval-buffer and
> got a for me suprising result:
>
> -------------------
> (defmacro mac () '(insert "           ; => before "))
>
> (defun func () (mac))
>
> (func)                ; => before
>
> (defmacro mac () '(insert "           ; => after"))
>
> (func)                ; => after
> -----------------
>
> Seems like I didn't understand the compilation process, for my
> understanding the redefinition of the macro "mac" after defining the
> function "func" should not effect the expansion anymore...
>
> Please, what am I missing here?

func is evaluated not compiled.  The evaluator expands macros every time
when func is called.

Helmut


reply via email to

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