From: Jesper Harder <harder@ifa.au.dk>
Subject: Re: how to turn this Gnus function into a macro?
Date: Thu, 08 Jan 2004 05:13:37 +0100 [thread overview]
Message-ID: <m3isjn9ixa.fsf@defun.localdomain> (raw)
In-Reply-To: <4nekubb8ry.fsf@collins.bwh.harvard.edu> (Ted Zlatanov's message of "Wed, 07 Jan 2004 19:09:53 -0500")
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Wed, 07 Jan 2004, harder@ifa.au.dk wrote:
>
>> Why do you want it as a macro? If it's just to save a function
>> call, then `inline' or `defsubst' is better.
>
> Because it can be much simpler, in the form
>
> ;; field is 'from or 'message-id for instance
> (eval (format "mail-header-%s" (symbol-name field)))
>
> Only a few lines, and it could be used with anything as the field,
> instead of the hard-coded field names I have now.
Yeah, I see what you mean.
`mail-header-*' should really be defsubsts rather than macros, but
unfortunately the Emacs byte compiler isn't good enough to make them
as efficient (it should be possible for a sufficiently smart
compiler).
> It also seemed like an interesting challenge, but I failed it pretty
> badly :)
You can sometimes cheat and funcall a macro by wrapping a lambda
around it:
(funcall (lambda (x) (macro x)) y)
But if you think about when macro expansion happens, it's obvious that
it can only work in a few cases.
next prev parent reply other threads:[~2004-01-08 4:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-07 22:19 Ted Zlatanov
2004-01-07 22:55 ` Jesper Harder
2004-01-08 0:09 ` Ted Zlatanov
2004-01-08 4:13 ` Jesper Harder [this message]
2004-01-08 2:13 ` Katsumi Yamaoka
2004-01-08 3:28 ` Ted Zlatanov
2004-01-08 3:33 ` Katsumi Yamaoka
2004-01-08 3:42 ` Jeremy Maitin-Shepard
2004-01-08 3:47 ` Katsumi Yamaoka
2004-01-08 4:06 ` Jeremy Maitin-Shepard
2004-01-08 6:06 ` Katsumi Yamaoka
2004-01-08 20:30 ` Ted Zlatanov
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=m3isjn9ixa.fsf@defun.localdomain \
--to=harder@ifa.au.dk \
/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.
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 NNTP newsgroup(s).