[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dave Touretzky's message on macros, destructuring, and functions



On the LispM, bvls for all primitive special forms take a standard format 
which never includes destructuring. DEFMACRO is not a primitive, but explicitly
a macro-writing macro and so it does extra work for you. This is perhaps not
ideal, but it is certainly the most consistent I have seen in any major Lisp
dialect, including Interlisp.

The destructuring capabilities offered by DEFMACRO need to be generally 
available, I will grant you that. Destructuring LET gives you that. Again,
for uniformity, the default LispM LET does not destructure. ALAN does have
a version available which does, however.

Perhaps if there were a subr, DESTRUCTURE, which allowed one to turn 

	({destructuringbvl} . {body})

into

	({nondestructuringbvl} . {destructuringbody})

then one could write trivial definitions like:

(MACRO DEFMACRO (FORM)
       `(MACRO ,(CADR FORM) ,@(DESTRUCTURE (CDDR FORM))))

(MACRO DEF-DESTRUCTURING-FUNCTION (FORM)  ; This needs another name
       `(DEFUN ,(CADR FORM) ,@(DESTRUCTURE (CDDR FORM))))

and the problem would be solved. In this way, the destructuring machinery
currently available only to DEFMACRO (or at least not documented otherwise)
would be able to serve a more general use, making things so easy to customize
that we wouldn't need this discussion which seems only to be asking why
destructuring is not as trivially available to SUBR-writers as it is to macro
writers.

-kmp