Subject: Re: Dynamic unquote ( , )?
From: (Rob Warnock)
Date: Fri, 10 Feb 2006 01:04:09 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Brian Downing  <> wrote:
| Rob Warnock <> wrote:
| > Good point. You do need to completely macroexpand the effective
| > or implicit (RUN macro generated) QUASIQUOTE form & subforms before
| > emitting any function calls, but that said, it *is* possible.[1]
| I'm not sure what you mean here.  As long as you don't try to pass your
| created QUASIQUOTE form to another macro that messes it up, the normal
| course of macroexpansion should take care of everything (as it will of
| course happen before any lexical variable references are evaluated)...

Sorry if I was confusing. All I meant was that before you can hand
the processing of the form off to some normal function (DEFUN-defined),
the chain of macroexpansion had to continue up to at least the point
where CL code had been generated that *used* [rather than just named]
all of the lexical variables involved in any of the unquotes.

Which what you just said, except that the desired end result *is* to
eventually pass the created QUASIQUOTE form off to an external function
for further processing [in the CLsh case, running a shell command].
It's just that the *values* of any lexical variables need to have
been made visible to CL code that will be executed before (or during)
that hand-off. E.g., this:

    (let ((file "some.file")
	  (ccflags '(-O))
	  (ldflags '(-lm -lbsd)))
      (run (cc ,@ccflags ,file ,@ldflags)))

should probably expand to something like this [assuming no
optimization of QUASIQUOTE whatsoever!!], where RUN-PROCESS
is a normal function:

    (let ((file "some.file")
	  (ccflags '(-O))
	  (ldflags '(-lm -lbsd)))
      (run-process (cons 'cc
			 (append ccflags
				 (cons file
				       (append ldflags nil))))))

That's all.

Are we violently agreeing now?  ;-}


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607