unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Nic Ferrier <nferrier@ferrier.me.uk>
Cc: emacs-devel@gnu.org
Subject: Re: macroexpand-all and cl-macrolet
Date: Sun, 18 Aug 2013 22:51:28 -0400	[thread overview]
Message-ID: <jwvhaems8dt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87wqnk15nl.fsf@ferrier.me.uk> (Nic Ferrier's message of "Sat, 17 Aug 2013 20:25:18 +0100")

> Is macroexpand-all not supposed to work with macrolet?

Depends what you mean.

>   (progn
>     (cl-macrolet 
>         ((nlet (bindings &rest body)
>            `(apply
>              (lambda ,(mapcar 'car bindings) ,@body)
>              (list ,@(mapcar 'cadr bindings)))))
>       (macroexpand-all
>        '(nlet ((a 1)
>                (b '(10)))
>          (* a (car b)))))) 

>    =>  (nlet ((a 1)
>               (b (quote (10))))
>          (* a (car b)))

cl-macrolet says that nlet will be bound as a macro during
macroexpansion of

    (macroexpand-all
        '(nlet ((a 1)
                (b '(10)))
          (* a (car b))))

But macroexpand-all will not run during the macroexpansion of
that expression.  After all, it's a plain function that will only be run
later after its macro-expansion is over.

So macroexpand-all will only get to look at the `nlet' call when that
code is *run* at which point the `nlet' definition provided by macrolet
is "long gone".


        Stefan



  reply	other threads:[~2013-08-19  2:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-17 19:25 macroexpand-all and cl-macrolet Nic Ferrier
2013-08-19  2:51 ` Stefan Monnier [this message]
2013-08-19 12:08 ` Wolfgang Jenkner
2013-08-19 18:14   ` Nic Ferrier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvhaems8dt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=nferrier@ferrier.me.uk \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).