[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible for a macro to expand to nothing?
From: |
Alan Mackenzie |
Subject: |
Re: Is it possible for a macro to expand to nothing? |
Date: |
Mon, 23 Nov 2009 16:31:34 +0000 (UTC) |
User-agent: |
tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386)) |
Drew Adams <drew.adams@oracle.com> wrote:
>> That is, not to a call to a null defun, but truly to nothing: i.e.,
>> the ensuing code (as least, when byte compiled) will be identical to
>> what it would have been, had the macro invocation been omitted.
>> I want something like this:
>> (defmacro ifdef (condition &rest forms)
>> "If the compile time CONDITION is non-nil, dump the FORMS to the
>> calling defun. Otherwise do nothing."
>> ......)
> Hi Alan,
> I'm not sure what you mean.
You might not be the only one. ;-)
I think I want to be able to do this:
(defun foo ()
(setq bar 1)
(ifdef baz (setq bar 2)))
, and if baz is nil at compile time, this function should be identical to
(defun foo ()
(setq bar 1))
.
> But if you mean something like "insert nothing", then you can do that
> by producing nil and then using ,@ inside a backquote. IOW, instead of
> inserting nil, you splice it in, which means inserting nothing.
That means I need to have "`,@" in the invoking defun, doesn't it? Maybe
that would work, even if it is ugly.
> HTH.
--
Alan Mackenzie (Nuremberg, Germany).
- Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Message not available
- Re: Is it possible for a macro to expand to nothing?,
Alan Mackenzie <=
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Message not available
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Message not available
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/24
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/24