Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!decwrl!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!a.cs.uiuc.edu!m.cs.uiuc.edu!liberte From: liberte@m.cs.uiuc.edu Newsgroups: comp.emacs Subject: Re: defmacro vs. defun Message-ID: <4300016@m.cs.uiuc.edu> Date: 16 Jul 88 00:35:00 GMT References: Lines: 25 Nf-ID: #R::-31:m.cs.uiuc.edu:4300016:000:1169 Nf-From: m.cs.uiuc.edu!liberte Jul 15 19:35:00 1988 [ /* Written 10:33 am Jul 15, 1988 by tjo@dasher.siemens.com in m.cs.uiuc.edu:comp.emacs */ [ /* ---------- "defmacro vs. defun" ---------- */ [ The compiled code of file B set up function call sequences for the [ macros if file A had not yet been loaded. Then the compiled code [ hangs when it tries to "call" the macro. Consider yourself lucky if you call the macro in such a way that it fails to byte-compile. It can be difficult to track down the problem otherwise. [ Question: How much is really saved by defining a macro instead of a [ function? The macros that caused the trouble were caar, cadr, cdar, etc. [ Also, for these simple macros, how much MORE would be saved by just [ writing out (car (car ...) ) instead of caar? If not byte-compiled, a macro call must be expanded every time it is seen. This will definitely take longer since the macro call is essentially a call to the macro as if it were a function followed by evaluation of the result. If byte-compiled, there is no penelty since the expansion is done (if it is known as a macro) at compile time. Dan LaLiberte uiucdcs!liberte liberte@cs.uiuc.edu liberte%a.cs.uiuc.edu@uiucvmd.bitnet