From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Is it possible for a macro to expand to nothing? Date: Sun, 29 Nov 2009 01:54:26 +0100 Organization: Informatimago Message-ID: <87ocmm40cd.fsf@galatea.local> 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> <874oof54k9.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259458860 14766 80.91.229.12 (29 Nov 2009 01:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Nov 2009 01:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 29 02:40:54 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 1NEYmT-0000cL-I7 for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Nov 2009 02:40:53 +0100 Original-Received: from localhost ([127.0.0.1]:32928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NEYmT-0000jY-6H for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Nov 2009 20:40:53 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 70 Original-X-Trace: individual.net GSMqzkex7mPaMKZhzgbaFwIWjT27HDhE4Sewe8zK8tNGY8B/5l Cancel-Lock: sha1:ZTlkNDM5YzFjYjY1YzQ5ZjhkNDBkMzU1ZjkzMWQ2YTRkOWI4NTAyNw== sha1:6fGFgsSkaZg/3eNOXK0x0T2afeg= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:175144 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:70218 Archived-At: Thierry Volpiatto writes: > pjb@informatimago.com (Pascal J. Bourguignon) writes: > >> Alan Mackenzie writes: >> >>> 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. >> >> Yes, emacs lisp is missing reader macros. In Common Lisp there's #+, >> #- and #., and reader macros may return 0 object. > > A little note about #., it have emacs equivalent `eval-when-compile': But #. is not eval when compile, it's eval when reading! Compilation occurs much later after reading... '#.(+ 1 2) --> 3 The result 3 is computed when reading the quote form. What is read is (quote 3): (read-from-string "'#.(+ 1 2)") --> (quote 3) ; 10 > I don't know the #- and #+ macros, what are they for? #+KEY THING is equivalent to cpp: #ifdef KEY THING #endif only it's not textual. #- <=> #ifndef What is tested is the presence of the keyword :KEY in the *FEATURES* list. (when (zerop (random 2)) (push :test *features*)) '(#+test present #-test absent) --> (present) or (absent) -- __Pascal Bourguignon__