Path: utzoo!utgpu!watserv1!watmath!att!att!emory!wuarchive!julius.cs.uiuc.edu!apple!bionet!arisia!roo!masinter From: masinter@parc.xerox.com (Larry Masinter) Newsgroups: comp.lang.lisp Subject: Re: Message-ID: Date: 1 Nov 90 05:20:08 GMT References: <1990Oct30.225047.17818@ux1.cso.uiuc.edu> <13279@crdgw1.crd.ge.com> Sender: news@parc.xerox.com Organization: Xerox PARC, Palo Alto, CA Lines: 39 In-reply-to: halvers@betelgeuse.crd.ge.com's message of 31 Oct 90 13:28:03 GMT >Using progn is the accepted way to handle macros with multiple forms. In >CLtL.1, Steele said that "if a progn form appears at a top level, then all >forms within that progn are considered by the compiler to be top-level >forms". Furthermore, in the latest version, apparently "compilers must >handle defining forms properly in *all* situations, not just top-level >contexts" [emphasis added]. There's still a distinction between top level and not, however. The following is fine: (progn (defmacro pair (x y) `(cons ,x ,y)) (defun get-pair (x y) (pair x y))) (get-pair 1 2) => '(1 . 2) but (defun definem () (defmacro pair (x y) `(cons ,x ,y)) (defun get-pair (x y) (pair x y))) (definem) (get-pair) is an error in a file to be compiled, since "Users must ensure that the body of the macro is evaluable at compile time if it is referenced within the file being compiled." Writing down what works and doesn't was painful. -- Larry Masinter (masinter@parc.xerox.com) Xerox Palo Alto Research Center (PARC) 3333 Coyote Hill Road; Palo Alto, CA USA 94304 Fax: (415) 494-4333