From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: rpw3@rpw3.org (Rob Warnock) Newsgroups: gmane.emacs.help Subject: Re: elisp macros problem Date: Wed, 28 Jul 2004 00:03:57 -0500 Organization: Rob Warnock, Consulting Systems Architect Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <87oem1bqop.fsf@thalassa.informatimago.com> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1090991236 4327 80.91.224.253 (28 Jul 2004 05:07:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2004 05:07:16 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 07:07:05 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bpgef-0006Uy-00 for ; Wed, 28 Jul 2004 07:07:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bpghm-0002dH-RG for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2004 01:10:18 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 28 Jul 2004 00:03:57 -0500 Original-Newsgroups: gnu.emacs.help,comp.lang.lisp X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: rpw3@rpw3.org (Rob Warnock) Original-Lines: 69 Original-NNTP-Posting-Host: 66.93.131.53 Original-X-Trace: sv3-LcDXVcatQ3kfXM1RAvFQbM+sEpP+atTurqWj4h17Sx2JW7WqRNu0NF4f8cUmytrpVYku1yKKy0r6S9h!tTF7hAh7w2AnWLOD8nl/OvQ8mSTsaST5/qKDai3XwFgYpkhlHUrIyk+CsqaKpVJiOQX4qLYSbNbI!QrtoOD0AhHKcOQ== Original-X-Complaints-To: abuse@speakeasy.net X-DMCA-Complaints-To: abuse@speakeasy.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.13 Original-Xref: shelby.stanford.edu gnu.emacs.help:124515 comp.lang.lisp:144309 Original-To: help-gnu-emacs@gnu.org 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19850 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19850 Pascal Bourguignon wrote: +--------------- | There is no fundamental difference between a function and a macro. | The only difference, is that functions are called at so called | "run-time" while macros are called at so called "compilation-time". | | Now, think about it, when you're using actually a lisp interpreter, | when is "run-time", and when is "compilation-time"? (You can check | CLHS to see how Common-Lisp defines these "times"). +--------------- Minor quibble: A macro-function gets called at "macro expansion time", which can be either during compilation (see CLHS "3.2.2.2 Minimal Compilation") or evaluation (CLHS "3.1.2.1.2.2 Macro Forms"). Whether the top-level interactive REPL provides at least "minimal compilation" or not is an implementation decision. SBCL always does full compilation (IIUC), whereas CMUCL does only minimal compilation of interpreted forms, and at that not until the first time the form is evaluated (by which I'm specifically referring to the body forms of a function typed to the REPL), for example: cmu> (defmacro say-expand (tag) (format t "I'm expanding here: ~s~%" tag) 'nil) SAY-EXPAND cmu> (defun foo () (say-expand in-foo) 37) FOO cmu> (foo) I'm expanding here: IN-FOO 37 cmu> (foo) 37 cmu> -Rob p.s. Other things besides calling a function can cause its body to be minimally-compiled in CMUCL, e.g., if right after the definition of FOO above you called DESCRIBE on it: cmu> (describe 'foo) FOO is an internal symbol in the COMMON-LISP-USER package. Function: # Function arguments: There are no arguments.I'm expanding here: IN-FOO [ <== LOOK! ] Its defined argument types are: NIL Its result type is: * Its definition is: (LAMBDA () (BLOCK FOO # 37)) cmu> (foo) 37 cmu> ----- Rob Warnock 627 26th Avenue San Mateo, CA 94403 (650)572-2607