[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Daniel L. Weinreb <DLW at MIT-AI>
- From: Dave Touretzky at CMU-10A
- Date: Tue ,30 Sep 80 21:35:00 EDT
Subject: Re: Macros and destructuring and functions, oh my!
CC: bug-lisp at MIT-MC, bug-lispm at MIT-MC, bug-macsymai at MIT-MC
In-Reply-To: Daniel L. Weinreb's message of 29 Sep 80 11:20-EST
If Lisp had EXPRs and nothing else, you could perhaps make a more
convincing argument to the effect that functions take multiple
separate arguments and not an argument vector. But that is not the
case. What does a LEXPR take if not an argument vector? What does
a FEXPR take as input that makes it fundamentally different from a
macro? Given that there are all these ways for a function to accept
arguments, it doesn't seem reasonable to rule out destructuring as
another useful variation.
Second, let's re-examine the notion of macro as part of the
metalanguage. This is a carryover from assembly language, where macros
used an entirely different set of operations than the source language
(e.g. simple string manipulation operations as opposed to machine
instructions) and were only used to generate compileable source lines
more efficiently. I claim a Lisp macro is just another kind of
function, like a FEXPR. The difference is that a macro is a function
that returns a form to be evaluated. Now, in the compiler the form is
compiled for later evaluation, but in the interpreter it is evaluated
immediately. But this is a just a feature of the way compilation works.
A macro is still a function, just like a FEXPR is. Therefore, adding
destructuring to DEFUN is a natural thing to do, because at least one
class of function (the macro) really needs it, and it is logically
consistent with the other classes as well.