Brian Downing <see-signature@lavos.net> wrote:
+---------------
| Rob Warnock <rpw3@rpw3.org> 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
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607