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


    Date: Wed, 5 Sep 1984  10:05 EDT
    From: "Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>

    I think destructuring bind would be a good thing to have in the language
    in any event.  Maybe DBIND would be an adequate name?  

The part of the name I object to is the word "bind", not the word "destructuring"!
To keep my criticism constructive, I'll propose DESTRUCTURE as a name.
On the other hand, Common Lisp did not change the name of MULTIPLE-VALUE-BIND,
which is an extremely analogous form that simply does a different kind of
destructuring, so maybe DESTRUCTURING-BIND is not such a bad name.

							   To avoid
    confusion, the arglist syntax would have to be exactly as in defmacro.

Of course, you have to specify an object to be destructured, you cannot
use &ENVIRONMENT, and DEFMACRO's magic cdr-ization of &WHOLE when seen at
the top level is not performed.  Otherwise it's the same as DEFMACRO.

Incidentally, we put the argument pattern -before- the object to be
destructured, rather than -after- (as in Masinter's recent message).
This is based on the philosophy that special forms that bind variables
should always have the variables at the front of the form.

It might be desirable to have two forms, with and without error checking
that the pattern matches the object in shape and length.  Currently we
have only the without-error-checking form, but the with-error-checking
form would be more consistent with DEFMACRO.  The two forms could either
have two names (a la CASE, ECASE, CCASE) or could be distinguished by
an & keyword (a la &optional and &allow-other-keys).

    Earlier proposals for DLET and DSETQ were tabled because there was
    substantial disagreement on the syntax for these, but a form that
    parallels arglist parsing in a defmacro would be conceptually clear and
    trivial to implement (given existing code for defmacro).

Agreed.  I can write a formal proposal after the Monterey meeting if there
is interest.

There are other possible kinds of destructuring besides this one, which should
not affect adoption of this one, but may be of interest.  The file referenced
in the header of this message, which can be retrieved from MIT-MC with anonymous
FTP, contains a discussion I wrote last year of some of the issues.  It does not
make any proposals, it only discusses.

Those poor wretches who are stuck with a user FTP program that refuses to allow
spaces in file names on the foreign host may send me mail and I will mail them a
copy of the file.