From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Is it possible for a macro to expand to nothing? Date: Sat, 28 Nov 2009 08:29:12 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: <87my2dc8d7.fsf@galatea.local> <873a44dcf2.fsf@galatea.local> <87pr78b6n9.fsf@galatea.local> <87ljhwb2dx.fsf@galatea.local> <87r5rjwoag.fsf@lion.rapttech.com.au> <87d4335x8t.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1259397648 30541 80.91.229.12 (28 Nov 2009 08:40:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Nov 2009 08:40:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 28 09:40:41 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NEIrA-0004zD-Pe for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Nov 2009 09:40:41 +0100 Original-Received: from localhost ([127.0.0.1]:52712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NEIrA-0008HX-DK for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Nov 2009 03:40:40 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!newsfeed.freenet.de!news.tu-darmstadt.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 50 Original-NNTP-Posting-Host: marvin.muc.de Original-X-Trace: colin2.muc.de 1259396952 26338 2001:608:1000::2 (28 Nov 2009 08:29:12 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Sat, 28 Nov 2009 08:29:12 +0000 (UTC) User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386)) Original-Xref: news.stanford.edu gnu.emacs.help:175133 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70208 Archived-At: Pascal J. Bourguignon wrote: > Tim X writes: >> On the other hand, Alan's arguments also have merit. If a macro can be >> useful in generating something other than a form that can be >> evaluated, such as a data structure and can do so in a way that is >> cleaner/simpler or just easier to understand than doing the same using >> functions, then it would make sense. His examples from the C modes >> seem to be a case in point. > Perhaps Alan's problem with functions comes from the confusion between > backquote and macros. Since backquote (and , and ,@) are often used in > macros, some people believe they can be used only in macros, and that > they ARE what macros are. Er, do I actually have a problem with functions? But no, I don't suffer that particular confusion between backquotes and macros, and have indeed used backquote when there hasn't been a macro within zeptoparsecs. > Far from it! I don't know any language more orthogonal than lisp. Maybe not, but even lisp only gets to about 89 degrees. It is missing an operator which does the same as ,@ outside backquote. This is one of the lacks which makes it so difficult to write an equivalent of C's #if. > Backquote can be used in a function to build a s-exp (including part of > a form) as it can be used anywhere. > Therefore it is really not easier to use macros to generate parts of a > form than function. It is if you need "side effects", like c-lang-defconst and friends do. [ Stuff read and appreciated. My brain's not up to it so early in the morning]. > If you wanted to use macros, in addition to the complexity of having > to use macroexpand to use it, you would have the difficulty of passing > the parameters, since a macro gets it's parameters from the source > form. In the case of a function, you have the choice to quote or not > to quote the parameters, with macros they're always quoted for you. In the case of a function, you've GOT to quote, which can get very tedious in some circumstances. That's probably the reason that Martin Stjernholm wrote c-lang-const etc. as macros. -- Alan Mackenzie (Nuremberg, Germany).