[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- From: RMS at MIT-AI (Richard M. Stallman)
- Date: Wed ,1 Oct 80 21:32:00 EDT
I think that destructuring in DEFUN would be a reasonable idea.
It's true that there are good ways to think of things if destrucuring
is absent, but that is not a reason for not having it, because there
are other good ways to understand things if destructuring is present.
If there are good ways to understand it either way, we can take our
choice based on other criteria and be assured that, either way, the
result will be possible to understand in a good way. This is much
better than arguing about which good way of understanding it is
"right".
However, I don't think that the Maclisp style of destructuring should
be adopted at all. It closes out the entire syntactc space -- if you
adopt it, you can't ever allow anything else, because there is no room
for an escape. If we want to allow things besides destructuring in
DEFUNs, LET, etc. -- such as, binding thh CAR of a list, which is
perfectly possible on thh Lisp machine (and maybe in Maclisp too) but
has n syntax to ask for it with -- or anything else we haven't
imagined yet -- then destructuring must be done with a different
syntax which leaves space for other things.
If destructuring is done as follows:
(defun foo (x (list z (list w y))) ...)
or, equivalently
(defun foo (x `(,z (,w ,y))) ...)
then there is room also to allow
(defun foo ((car x)) ...) which puts the argument in the car of x,
or combine them as in (defun foo ((cons (car x) (cdr x))) ...)
which displaces the argument into x.
We can also handle multiple values with this scheme.
If we have a function (VALUES x y z) that returns three values, x y
and z, then we can do (setf (values x y z) ...) instead of using
multiple-value, and we can do (let (((values x y z) ...)) ...)
instead of using multiple-value-bind.
I wonder whether this extends to defun in any way?