all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Understanding macros and the compilation flow
Date: Thu, 03 Jun 2010 19:22:02 +0200	[thread overview]
Message-ID: <m2wrugyqth.fsf@gmail.com> (raw)
In-Reply-To: 4694158d-131e-435d-83ff-d67d0adb699a@c11g2000vbe.googlegroups.com

* 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	other threads:[~2010-06-03 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03 15:03 Understanding macros and the compilation flow LanX
2010-06-03 17:22 ` Helmut Eller [this message]
     [not found] ` <87fx14rpyi.fsf@kuiper.lan.informatimago.com>
2010-06-03 17:45   ` LanX
     [not found] ` <jwvljaulvog.fsf-monnier+gnu.emacs.help@gnu.org>
2010-06-04 15:34   ` LanX
2010-06-04 16:48     ` Andreas Politz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wrugyqth.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.