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: Fri, 27 Nov 2009 14:52:01 +0100 Organization: Informatimago Message-ID: <873a406poe.fsf@galatea.local> References: <87vdh1ccra.fsf@galatea.local> <87my2dc8d7.fsf@galatea.local> <873a44dcf2.fsf@galatea.local> <87pr78b6n9.fsf@galatea.local> <87ljhwb2dx.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 1259332865 5835 80.91.229.12 (27 Nov 2009 14:41:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Nov 2009 14:41:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 27 15:40:58 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 1NE20I-0007Ou-Br for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Nov 2009 15:40:58 +0100 Original-Received: from localhost ([127.0.0.1]:53953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NE20I-0007GU-2P for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Nov 2009 09:40:58 -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 yzoHRSCAfi5FIislCb3gjAeHApAEdCeh25tfoz5tpLffmLgvub Cancel-Lock: sha1:OWEwMDYxMDVmOTVmMTVjM2UwNmViMWZjZmI4ZjUxYzc1ZWE1YzMxOQ== sha1:mccAnp6x700Y3KMEWfpeYl5OmpU= 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:175111 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:70185 Archived-At: Alan Mackenzie writes: > Kevin Rodgers wrote: >> Alan Mackenzie wrote: > >>> Your notion of the correct use of macros seems to be a religious idea >>> rather than one fully thought through. You justify it with circular >>> reasoning. Whilst using a macro to generate an evalable form may be >>> the most usual thing, there is no reason not to use it to produce >>> other list structure. > >> Except that such macros can only be executed in a particular context >> i.e. they depend on something that cannot be expressed via their >> argument list. > > Yes, many lisp structures can only be "executed" in particular contexts, > `,@' for example, yet nobody slags them off for that. This is different. Why can't you see it? ,@ cannot be put outside of a ` context, never ever. When you define a macro (defmacro m ...) then (m ...) can be put in any form context, always. Oops! Not when you write a macro that returns not a form. You've made an exception, and therefore a lot of complexity for the reader of your code, and a lot of time lost for the debugger of your code. Now instead of being able to use a macro at any place a form is acceptable, we have to go read the source of the macro, and understand whether it returns a form or data, and if it's the later, we have to understand how to wrap it in some boilerplate, which was by the way why macros where invented for in the first place, to avoid boilerplate!!! How silly! >> At best that is poor style, and at worst it is poor engineering. > > That is so supercilious - you haven't even given an example of this > phenomenom, discussing why it is poor style or poor engineering. There's > just this vague insinuation that you know better. Yes, it seems that we have to spell it in all details. > I will give an example, namely `c-lang-defconst' from cc-defs.el. Are > you going to assert that it is poor style, or even poor engineering, > simply because it generates an internal data structure rather than an > excutable form? You are plain wrong. c-lang-defconst, as any other macro, generates only executable lisp code: (c-lang-defconst test t nil c "abc") --> test (macroexpand '(c-lang-defconst test t nil c "abc")) --> (progn (c-define-lang-constant (quote test) (quote (((c-mode) . "abc") (t))) (quote (\83)))) > If so, then it's up to you to say how it could have been > done better, preferably submitting a patch. There's no need it already returns lisp CODE, as it should. -- __Pascal Bourguignon__