Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!execu!sequoia!meritaus!dan From: dan@meritaus.UUCP (Daniel Haug) Newsgroups: comp.lang.lisp Subject: Re: Question about Macros (Common Lisp) Message-ID: <377@meritaus.UUCP> Date: 5 Feb 90 16:48:17 GMT References: <31480@shemp.CS.UCLA.EDU> Distribution: usa Organization: Merit Technology Austin Div. Lines: 38 From article <31480@shemp.CS.UCLA.EDU>, by srt@maui.cs.ucla.edu (Scott Turner): > Let's say that I define this macro in the RULE package. Later on, I go to > use this in the USER package, and looking at the macro-expansion I see > this: > > (lambda (rule::*spec*) (eql *spec* 'hyper)) > > Not what I expected. What's happened? Well, during the reading of the list > that forms the backquote structure in my macro, the reader found "*spec*" and > turned that into an atom in the RULE package, hence rule::*spec*. > If I were writing this, and wanted to have some lexical variables available to the user of RULE, I would export these symbols from RULE. Then the user of the RULE system would either have to USE the RULE package, or explicitly reference the variables with a RULE: prefix: So, your rule system would define this: (in-package :rule) (export '(define *spec*) :rule) and the user would do the following from his/her own package (a.k.a USER): (use-package :rule) (define some-rule () (eql *SPEC* 'hyper) ...) Also humbly offered... -- dan haug ==================================================================== Phonenet: (512)338-2450 Internet: execu!sequoia!meritaus!dan@cs.utexas.edu UUCP: {uunet, cs.utexas.edu!execu, texbell}!sequoia!meritaus!dan ``When all you have is a hammer, everything begins to look like a nail.''